-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (41 loc) · 998 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"flag"
"fmt"
"runtime"
"uk.ac.bris.cs/gameoflife/gol"
"uk.ac.bris.cs/gameoflife/sdl"
)
// main is the function called when starting Game of Life with 'go run .'
func main() {
runtime.LockOSThread()
var params gol.Params
flag.IntVar(
¶ms.Threads,
"t",
8,
"Specify the number of worker threads to use. Defaults to 8.")
flag.IntVar(
¶ms.ImageWidth,
"w",
512,
"Specify the width of the image. Defaults to 512.")
flag.IntVar(
¶ms.ImageHeight,
"h",
512,
"Specify the height of the image. Defaults to 512.")
flag.IntVar(
¶ms.Turns,
"turns",
10000000000,
"Specify the number of turns to process. Defaults to 10000000000.")
flag.Parse()
fmt.Println("Threads:", params.Threads)
fmt.Println("Width:", params.ImageWidth)
fmt.Println("Height:", params.ImageHeight)
keyPresses := make(chan rune, 10)
events := make(chan gol.Event, 1000)
gol.Run(params, events, keyPresses)
sdl.Start(params, events, keyPresses)
}