on-internet
← Community

Battleship game in Java language

Stack Overflow ·

I need some help with my code for my school project. I have done some simple game in Java, it is on 5x5 board, randomly positioned ships. I am stuck with something that I can't manage alone, I need some brains more to help me with it. I need to make a ship which need to position itself on 2 places on board, so if you are playing against PC you'll need two shots to sink that boat. Code is below: public static void main(String[] args) { int[][] board = new int[5][5]; int[][] ships = new int[3][2]; int[] shoot = new int[2]; int attempts=0, shotHit=0; initBoard(board); initShips(ships); System.out

Comments

Sign in or sign up to comment and upvote.

No comments yet.