Skip to content

MonikaKrella/SeaMasters-Battleship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seamlogo

SeaMasters-Battleship

Your simulator of the Battleship game!

Project assumptions

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

Technical issues

  • 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.

Different shooting algorithms

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.

Rules

It was written based on classical rules. The board has always 10x10 fields and set of ships is also always the same.

Rules of ship positioning

Following the rules bot algorithm places ships with at least 1 empty field between them, in vertical and horizonal direction.

Rules of turns

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.

Winning rules

The big battle is won by the pirate, who first destroys all enemies ships. At that moment game is finished.

Tech stack

  • ASP.NET Core
  • .NET 6.0
  • C# 10.0

Ideas for future

  • tests (waiting in pull request)
  • mamanging player vs computer mode
  • managing player vs player mode

Screenshots

Swagger:

image image

Frontend:

image

About

Battleship game logic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages