Implementation of the infamous game Battleship or Sea Battle using the logic programming language Prolog
The aim of the game is to guess were the boat of the opponent is. We only implemented 1 boat that can have 1, 2 or 3 blocks of width, depending on the difficulty we choose.
- The board is square.
- You can choose a size for the board. Maximum 9 columns.
- You can choose a difficulty before starting the game.
- Depending on the difficulty there will be more or less attempts and the size of the boat will vary.
- In each round you can put an x/y position.
- If the attempts finish and you haven't sunk the boat you loose.
- To exit the game you can put 0 in a position.
To play the program it's necessary to have Prolog installed. After that we can execute the program following the syntax:
prolog src/sink_the_float.pl
After that we can start the game writing:
play.
First of all we have to choose the size of the board, followed by the desired difficulty. Finally it will show the number of rounds left to guess the opponent boat.
Starting the Game
Game Finished - Win
Game Finished - Loose