Giter Site home page Giter Site logo

battleshipgame's Introduction

BattleShipGame

BattleShip Game Example

Made with Java JDK 20 (https://www.oracle.com/java/technologies/javase/jdk20-archive-downloads.html) and JUnit 5 for Java. Written with the use of Eclipse IDE Workspace (https://www.eclipse.org/ide).

Game is executed with the Main.java file (F11 with Eclipse). JUnit test file included "BattleShipTest.java" (also F11 with Eclipse).

--- Once the game is being executed ---

  1. Highscores are read from highscores.txt file. Only top 10 are shown. Needs equal or lower amount of turns for a replacement. By default there are no scores set.

  2. Player 1 starts

  3. Place ship with Mouse Button 1 (Left Button) by clicking on a square. Ship shows up green to indicate it's still being placed. Shows in gray once it's permanently placed. A ship is ranging from 2 to 5 parts in a straight line horizontal or vertical. Each ship size can only exist once, except for size 3 which can exist twice.

  4. Ships which are still being placed can be removed with Mouse Button 3 (Right Button) by clicking on a square. Once it's permanantly placed it can no longer be removed.

  5. To permanently place a ship click on a green square again. If it's valid it will then turn permanent and is shown as gray.

  6. Once an action has been taken (placed ship or hit spot) the player has to press the End Turn button to pass the turn along to the other player.

  7. When both player have placed 5 ships the game begins once that turn has been passed.

  8. Click on a sqaure with Mouse Button 1 (Left Button) once the game has started to target a spot. It will then show a green circle if you hit a ship or a red cross if it's a miss. If one of your own ships is hit the parts which have been hit show up in orange.

  9. Game ends once either player successfully hit all ships. The winning player is then asked to enter his name if he/she earned a spot for the top 10.

  10. Game can be restarted by pressing Restart.

--- Keyboard Shortcuts ---

  1. Enter: End Turn for player (when usable)

  2. Space: Restart game

  3. Escape: Exit game

  4. F5: Setup the game with placed ships for both players for quick testing

  5. F6: Setup the game and hit all spots in succession for quick testing

  6. F7: Setup the highscores list with preset scores

  7. F8: Delete the highscores

battleshipgame's People

Contributors

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