14 lines
228 B
Go
14 lines
228 B
Go
package main
|
|
|
|
type square struct {
|
|
status uint8 //0 is empty, 1 is missed, 2 is alive, 3 is destroyed
|
|
ship *ship
|
|
}
|
|
|
|
func (square *square) hit() uint8 {
|
|
if square.status%2 == 0 {
|
|
square.status++
|
|
}
|
|
return square.status
|
|
}
|