Commit 55d7aab7 authored by Boris Mühmer (ADESTIS)'s avatar Boris Mühmer (ADESTIS) 💬
Browse files

merged current dev state

parent daa995f7
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+1 −0
Original line number Diff line number Diff line
.idea
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ import (
	"strconv"
	"time"

	"repositories.muehmer.net/boris.muehmer/wator/wator"
	"repositories.muehmer.net/bsmrgo/wator/wator"
)

func main() {
+8 −8
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ func (w *Wator) position(x int, y int) position {
}

func fishNeighours(w *Wator, o *Ocean, p position) []position {
	var ep []position
	var eps []position
	for _, ap := range []position{
		w.position(p.x+1, p.y),
		w.position(p.x-1, p.y),
@@ -172,15 +172,15 @@ func fishNeighours(w *Wator, o *Ocean, p position) []position {
		w.position(p.x, p.y-1),
	} {
		if o.isWater(ap) {
			ep = append(ep, ap)
			eps = append(eps, ap)
		}
	}
	return ep
	return eps
}

func sharkNeighbours(w *Wator, o *Ocean, p position) ([]position, []position) {
	var fp []position // fish positions
	var ep []position // empty positions
	var fps []position // fish positions
	var eps []position // empty positions
	for _, ap := range []position{
		w.position(p.x+1, p.y),
		w.position(p.x-1, p.y),
@@ -188,13 +188,13 @@ func sharkNeighbours(w *Wator, o *Ocean, p position) ([]position, []position) {
		w.position(p.x, p.y-1),
	} {
		if o.isWater(ap) {
			ep = append(ep, ap)
			eps = append(eps, ap)
		}
		if o.isFish(ap) {
			fp = append(fp, ap)
			fps = append(fps, ap)
		}
	}
	return ep, fp
	return eps, fps
}

func randomNeighbour(ps []position) (position, bool) {