If we are going to shoot, how do we get to know the result? In a real life environment, we would get this information by some network protocol. But again, for the sake of simplicity, we put the information about an opponent ship and probabily distribution together.
At the start of the game we know nothing aboout the opponent board:
Next we need to calculate probabily distribution:
… and merge it with an opponent board:
So we can check how precise do we shoot:
What if we finally start shooting?
By traversing the board from left to right…
… we could prove that everything is working as expected:
However, we don’t get any information about sunk ships. Let’s fix it.