Battleship Game: Arduino Uno

Battleship Game: Arduino Uno

Beep Beep Boom

Created on 14th January 2023

Battleship Game: Arduino Uno

Battleship Game: Arduino Uno

Beep Beep Boom

The problem Battleship Game: Arduino Uno solves

It acts as a source of entertainment.

Challenges I ran into

The Arduino's delay function posed quite a difficulty because it blocks the functioning of the entire function for the specified duration. However this gave rise to the problem that the program cannot perform the two actions of sending the bomb ahead and also checking if the battleship and bomb meet. This meant that the game could not end at all. I got over this problem by using a flag in the sendNextBomb() function which would change its value inside the function itself when the bomb is at row index 5. Then in the loop the flag would be checked for and the bomb would be moved to row index 6. Now if the column index of bomb and battleship match, the game would end or else it would continue. In this manner, the delay problem was overcome.

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio