aliens

package
v0.0.0-...-9bbeb27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aliens

type Aliens struct {
	// contains filtered or unexported fields
}

func New

func New(population int, numberOfLocations int) Aliens

Init aliens locations with random cities. Assumption: we can have more than one aline per city initially, but the start fighting after the first move.

func (*Aliens) FightingSync

func (a *Aliens) FightingSync() map[int][]int

Fighting of Aliens plus Killing and return list of destroyed Cities.

func (Aliens) GetLocation

func (a Aliens) GetLocation(alien int) int

func (Aliens) IsDead

func (a Aliens) IsDead(alien int) bool

func (Aliens) Location

func (a Aliens) Location(alien int) int

func (*Aliens) MoveAlienAsync

func (a *Aliens) MoveAlienAsync(alien int, dst int, movementLock sync.Mutex)

Move Alien Async

func (*Aliens) MoveAlienSync

func (a *Aliens) MoveAlienSync(alien int, dst int)

Move Alien Sync

func (Aliens) NumberOfAliens

func (a Aliens) NumberOfAliens() int

func (Aliens) NumberOfAliensAlive

func (a Aliens) NumberOfAliensAlive() int

func (*Aliens) SetDead

func (a *Aliens) SetDead(alien int)

func (*Aliens) SingleFight

func (a *Aliens) SingleFight(city int, cityName string) bool

Fighting of Aliens plus Killing and return bool for city destroyed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL