Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GameResult ¶
type GameResult struct {
Player1Board string
Player2Board string
Player1Hits int
Player2Hits int
Result string
}
GameResult holds the results of the game Player{1/2}Board is the representation of the board of the player Player{1/2}Hits is the total hits of a player on his opponent
func PlayGame ¶
func PlayGame(gameData []string) (gameResult GameResult, err error)
PlayGame initiates the battleship game between two players gameData is the players raw data of format Grid Size - 5 Total Ships - 5 Player1 Ship Positions - 1:1,2:0,2:3,3:4,4:3 Player2 Ship Positions - 0:1,2:3,3:0,3:4,4:1 Total Missiles for each player - 5 Player1 moves on Player2 - 0:1,4:3,2:3,3:1,4:1 Player2 moves on Player1 - 0:1,0:0,1:2,2:3,4:3
Click to show internal directories.
Click to hide internal directories.