Can I minimax a battleship 2 player game?

I have a game project to implement and was thinking of building a battleship game (

The project requires me to build an AI computer that can run a minimax algorithm.

Is it possible to implement minimax on this kind of game?

1 answer

  • answered 2022-04-12 12:59 eligolf

    Short answer: No.

    The minimax algorithm needs some sort of evaluation of the gamestate in every node. In battleship you don't have all information as a player or AI (opponent ships are not known) which makes it impossible to do this. You could of course cheat and let the AI test all possible moves and find the hidden ships X moves ahead, but I would say this is against the rules. The AI would then always find the ship and always make hits which would also make it very boring to play against.

    You can find some inspiration for example here on other algorithms to use.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum