freego/main.go

48 lines
814 B
Go
Raw Normal View History

2022-02-18 18:36:18 -05:00
package main
import "fmt"
func main() {
2022-02-20 18:36:52 -05:00
//red := NewDummyPlayer(Red)
//blue := NewDummyPlayer(Blue)
g := NewGame()
g.state = gameSetup
printboardcolours(g)
2022-02-18 18:36:18 -05:00
return
}
func addpiece(game *Game, rank int, c Colour, x int, y int) {
2022-02-20 18:36:52 -05:00
res, err := game.SetupPiece(x, y, NewPieceFromInt(rank, c))
2022-02-18 18:36:18 -05:00
if err != nil {
panic(err)
}
if !res {
panic("can't setup")
}
}
func addriver(game *Game, x int, y int) {
2022-02-20 16:07:20 -05:00
res, err := game.board.AddTerrain(x, y, 1)
2022-02-18 18:36:18 -05:00
if err != nil {
panic(err)
}
if !res {
panic("can't river")
}
}
2022-02-20 18:36:52 -05:00
func printboardcolours(g *Game) {
for i := range g.board.board {
for j := range g.board.board[i] {
c := "X"
if g.board.board[i][j].colour == Red {
c = "R"
} else if g.board.board[i][j].colour == Blue {
c = "B"
}
fmt.Printf("%v", c)
}
fmt.Println("")
}
}