Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Drakirus/Marabunta-24h-du-code
Browse files Browse the repository at this point in the history
  • Loading branch information
TitouanT committed Jan 20, 2018
2 parents 21eaae6 + 04a0751 commit d1c895e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ant.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def moveTo(self, uniq):
print ("MOVE_TO " + str(uniq) )

def putPheromone(self, t):
print ("PUT_PHEROMONE " + str(type))
print ("PUT_PHEROMONE " + str(t))

def changePheromone(self, uniq, t):
print ("CHANGE_PHEROMONE " + str(uniq) + " " + str(t))
Expand All @@ -92,4 +92,4 @@ def suicide(self):
print ("SUICIDE")

def commitMemory(self):
print ("SET_MEMORY " + str(self.m0) + " " + str(self.m1))
print ("SET_MEMORY " + str(self.m1) + " " + str(self.m2))
16 changes: 8 additions & 8 deletions ia.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def antIA(ant):
return

# partie calcul min distance
ant.say("test")
phs = compareKey("id", ant.arrSeePheromone, operator.eq, idPathStart - 1)

nestsFriendly = compareKey("friend", ant.arrSeeNest, operator.eq, "FRIEND")
Expand All @@ -59,32 +60,31 @@ def antIA(ant):
distance = min(nestDist, phDist)

if distance["dist"] > DISTANCE_NEED_PUT_PH:
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP")
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP 2")
ant.putPheromone(idPathStart)
idPathStart += 1
ant.setMemory(idPathStart, gotFood)
ant.commitMemory()
return
if phs:
distance = minMaxKey("dist", phs, min)

if distance["dist"] > DISTANCE_NEED_PUT_PH:
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP")
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP phs")
ant.putPheromone(idPathStart)
idPathStart += 1
ant.setMemory(idPathStart, gotFood)
ant.commitMemory()
return

if nestsFriendly:
if nestsFriendly and len(phs) == 0:
distance = minMaxKey("dist", nestsFriendly, min)

if distance["dist"] > DISTANCE_NEED_PUT_PH:
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP")
ant.say("ON A BESOIN DE PLACER UN PHEROMONE, ON S ELOIGNE TROP nest " + str(idPathStart))
ant.putPheromone(idPathStart)
idPathStart += 1
ant.setMemory(idPathStart, gotFood)
ant.commitMemory()
# idPathStart += 1
# ant.setMemory(idPathStart, gotFood)
# ant.commitMemory()
return


Expand Down
2 changes: 1 addition & 1 deletion wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def readAnt(cls):
ant.setFood(food)

elif cmd == 'SEE_PHEROMONE':
ident, zone, typePheromone, persistance = args
ident, zone, dist, typePheromone, persistance = args
ident = int(ident)
dist = int(dist)
typePheromone = int(typePheromone)
Expand Down

0 comments on commit d1c895e

Please sign in to comment.