Naval Battle

Following game has been created as a project work for the course “Tik-76.030 Basic Course in Programming Y1” in Helsinki University of Technology. Game allows human player to challenge computer. During setting-up phase built-in logic assures that ships are not touching each other. When ship is sunk all squares around it are marked and neither human player nor computer can choose those squares to shoot anymore. Computer AI is rudimentary. It shoots randomly but never at the same square twice.

Game.java:

[crayon url=”https://stotski.com/img/misc/naval_battle/Game.java”][/crayon]

Player.java:

[crayon url=”https://stotski.com/img/misc/naval_battle/Player.java”][/crayon]

Read.java:

[crayon url=”https://stotski.com/img/misc/naval_battle/Read.java”][/crayon]

Test run:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.