Giter Club home page Giter Club logo

seabattle's Introduction

SeaBattle Console Game in C#

SeaBattle is a classic strategy game where two players compete against each other to sink each other's ships on a grid-based battlefield. In this version of the game, you will be playing against the computer.

How to Play

  1. The game is played on a 10x10 grid.
  2. Each player has a fleet of ships consisting of a battleship (4 squares), cruiser (3 squares), submarine (2 squares), and destroyer (1 squares).
  3. Each turn, you will select a square on the enemy grid to fire a shot.
  4. The computer will respond with a hit or a miss. If you hit an enemy ship, the square will be marked with an 'X'. If you miss, the square will be marked with an 'x'.
  5. The game ends when all of one player's ships have been sunk.

Getting Started

To get started with the game, simply clone the repository and open it in your preferred C# IDE. The code is organized into several files:

  • Game.cs contains the main game loop.
  • Map.cs defines the game board and provides methods for placing and checking ships.
  • Cell.cs defines the ship class and provides methods for checking if a ship has been hit or sunk.
  • Program.cs contains the main method and is used to run the game.
  • Player.cs defines the player class and provides methods for shooting in ships, or any other cells
  • RoundManager.cs defines the round manager class and provides methods for managing the game rounds
  • Menu.cs defines the menu class and provides methods for displaying the game menu

Player inputs

  • PlayerArrowInput.cs defines the input class and provides methods for getting input from the user. (Arrow controls)
  • PlayerStringInput.cs defines the input class and provides methods for getting input from the user. (String controls A2)

Bot inputs

  • EasyBotInput.cs defines the input class and provides methods for getting input from the computer. (Easy bot)
  • MediumBotInput.cs defines the input class and provides methods for getting input from the computer. (Medium bot)
  • HardBotInput.cs defines the input class and provides methods for getting input from the computer. (Hard bot)

To run the game, simply compile and run the Program.cs file. The game will start with the computer randomly placing its ships on the board, and then prompt you to place your own ships. Once both players have placed their ships, the game will begin.

Conclusion

SeaBattle is a classic game that has been enjoyed by generations. This version of the game provides a fun and challenging experience that will keep you entertained for hours. So what are you waiting for? Download the code and start playing!

seabattle's People

Contributors

timursl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.