shipPlace.go 342 B

1234567891011121314151617
  1. package game
  2. func (game *Game) shipPlace(ship pieces, x int, y int, orientation int) {
  3. for v := range ship.length {
  4. switch orientation {
  5. case updown:
  6. for i := 0; i < v; i++ {
  7. game.leftShips[x][y+1] = ship.abreviation
  8. }
  9. case leftright:
  10. for i := 0; i < v; i++ {
  11. game.leftShips[x+1][y] = ship.abreviation
  12. }
  13. }
  14. }
  15. }