Coders Packet

Command-line Battleship Board Game with probability density backed bot in C++

By Abdullah Jamal

A command line board game in which two players arrange five ships on a grid of 10 x 10 and then strike each others ships in alternate turns until all the ships are destroyed.

Battleship Board Game (probability density backed AI)

A command line board game in which two players arrange five ships on their maps and then strike each others ships in alternate turns until all the ships are destroyed. Bot uses probability density map to reduce number of average turns required for victory to 17 !

Supports multiplayer.

Supports arranging ships on auto and manual mode.

Logs game statistics in file.

Technologies used :- C++

Game Instructions for Windows :

first extract the zip file

Open the battleship.cpp file to open the command line interface for game.

Game menu

Battleship game supports 2 options for arranging ship :-

1) auto

2) manual

To arrange ship manually enter coordinates for each part of ship

example: to arrange submarine which is of size 3, enter d9 e9 f9, as in below pic

The Game includes following ships :

Aircraft carrier: size 5

Battleship: size 4

destroyer: size 3

submarine : size 3

patrol boat: size 2

after arranging all ships :-

after arranging all ships if you still dont like the orientation, you can change to re-arrange ships again

on confirming the orientation of ships the game begins.

The status of all ships and turn number is displayed on top of game board.

0 : denotes water

1 : denotes ship hit

empty space : denotes content not known ( could be miss or hit).

if target get hit, the player gets a bonus shot else the turn passes to the opponent.

On winnning the game, the winning players map is shown on the screen

------------------------------------------------------------------------------------------

 

 

 

Download project

Reviews Report

Submitted by Abdullah Jamal (Abdullahj)

Download packets of source code on Coders Packet