go:make_board: Converted snake case to camel case

This commit is contained in:
Logen Kain 2017-10-03 00:48:20 -07:00
parent 778b6dd7ab
commit c297adac81

View File

@ -5,39 +5,39 @@ import (
)
func main() {
const board_y int = 7
const board_x int = 12
const boardY int = 7
const boardX int = 12
board := make_board(board_y, board_x)
board := makeBoard(boardY, boardX)
// Pretend that the player did something in the middle
player_move_y := board_y / 2
player_move_x := board_x / 2
playerMoveY := boardY / 2
playerMoveX := boardX / 2
board[player_move_y][player_move_x] = "@ "
board[playerMoveY][playerMoveX] = "@ "
print_board(board)
printBoard(board)
}
func make_board(size_y, size_x int) [][]string {
func makeBoard(sizeY, sizeX int) [][]string {
//Make an array of empty strings
// Rows
board := make([][]string, size_y)
board := make([][]string, sizeY)
for y := 0; y < size_y; y++ {
for y := 0; y < sizeY; y++ {
//Make each array an array of empty strings
//cols
board[y] = make([]string, size_x)
board[y] = make([]string, sizeX)
// and populate em
for x := 0; x < size_x; x++ {
for x := 0; x < sizeX; x++ {
board[y][x] = "_ "
}
}
return board
}
func print_board(board [][]string) {
func printBoard(board [][]string) {
for y := 0; y < len(board); y++ {
for x := 0; x < len(board[y]); x++ {
fmt.Print(board[y][x])