Your simulator of the Battleship game!
The game is designed in a way that server is fully responsible for executing game logic, including logic of bots. Any website can use this API to run battleship. If you want to see frontend part prepaired for this simulator, visit: https://github.com/MonikaKrella/SeaMastersFront
- Data from server is avaiable by simple API, with two endpoinds for creating game and making player's turn.
- It's using a single game manager for all clients and storing their games by games' ids, which is necessary for getting data about every turn.
The way of generating shots depends on situation in game. If it is first shot of current player, it make a shot randomly. However if first shot hitted other player ship, attacking player makes "searching shot" in closest neighbours of field, where ship was hitten.
It was written based on classical rules. The board has always 10x10 fields and set of ships is also always the same.
Following the rules bot algorithm places ships with at least 1 empty field between them, in vertical and horizonal direction.
It is decided randomly which player will start a game. At single turn player makes at least one shot. If shot misses, active player just get that info to put it at shooting board. Then roles are changing - second player becomes an attacking player. If shot is a hit, acive player gets possibility to make extra shot. Every well-aimed shot generates one more extra shot until player missed.
The big battle is won by the pirate, who first destroys all enemies ships. At that moment game is finished.
- ASP.NET Core
- .NET 6.0
- C# 10.0
- tests (waiting in pull request)
- mamanging player vs computer mode
- managing player vs player mode