summaryrefslogtreecommitdiff
path: root/backend.go
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-01-13 23:02:03 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2020-01-13 23:02:03 -0500
commitec8b9d3d17edc79b348122601579cc0b312d2d34 (patch)
tree439cb6312ca153a517d7abd461beff0815725db4 /backend.go
parent616e97bae68aeb8f2fd6ec654370b10a9cc2454c (diff)
Log works
Diffstat (limited to 'backend.go')
-rw-r--r--backend.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/backend.go b/backend.go
index 6979d59..3be4bd5 100644
--- a/backend.go
+++ b/backend.go
@@ -131,11 +131,12 @@ func (plyr *player) InitBoat(boatID, orientation, x, y int) {
}
func (plyr *player) Hit(x, y int) bool {
+ // We change the coord status to hit
+ // We add the id of the boat since we know it now.
plyr.prey.primary[y][x][2] = 1
- // We change the coord status to hit and add the id of
- // the boat since we know it now.
plyr.target[y][x] = [2]int{1, plyr.prey.primary[y][x][0]}
- if BoatID := plyr.prey.primary[y][x][0]; BoatID < 6 {
+ // If that coordinate contains a boat
+ if BoatID := plyr.prey.primary[y][x][0]; BoatID < 5 {
switch plyr.prey.primary[y][x][1] {
case 1, 2, 5: // If the hit boat was vertical
// We suppose the boat is sunk since it only takes one unhit coordinate to prove this wrong