From 93e5494f705627d3c2d25f8d068e7eb97464f419 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Tue, 3 Oct 2017 01:32:37 -0700 Subject: [PATCH] go:make_board: Changed makeBoard to accept a symbol to place in the array --- go/make_board/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/go/make_board/main.go b/go/make_board/main.go index f97f2d6..88e1de8 100644 --- a/go/make_board/main.go +++ b/go/make_board/main.go @@ -8,19 +8,19 @@ func main() { const boardY int = 7 const boardX int = 12 - board := makeBoard(boardY, boardX) + board := makeBoard(boardY, boardX, "_") // Pretend that the player did something in the middle playerMoveY := boardY / 2 playerMoveX := boardX / 2 - board[playerMoveY][playerMoveX] = "@ " + board[playerMoveY][playerMoveX] = "@" printBoard(board) } -func makeBoard(sizeY, sizeX int) [][]string { +func makeBoard(sizeY, sizeX int, symbol string) [][]string { //Make an array of empty strings // Rows board := make([][]string, sizeY) @@ -31,7 +31,7 @@ func makeBoard(sizeY, sizeX int) [][]string { board[y] = make([]string, sizeX) // and populate em for x := 0; x < sizeX; x++ { - board[y][x] = "_ " + board[y][x] = symbol } } return board