Compare commits
1 Commits
master
...
0b12b496bc
Author | SHA1 | Date | |
---|---|---|---|
|
0b12b496bc |
@@ -23,4 +23,4 @@ Other key bindings are:
|
||||
|
||||
## Playing against AI
|
||||
|
||||
If you want to play against the AI instead of other players, supply the corresponding CLI flag: `pipenv run ./maxman.py --ai <number of AI players>`
|
||||
If you want to play against the AI instead of other players, supply the corresponding CLI flag: `pipenv run ./maxman.py --ai`
|
||||
|
@@ -115,14 +115,11 @@ class AI:
|
||||
return
|
||||
|
||||
target = self.target
|
||||
if (target and target.size > self.man.size) or random.random() * 100 < 10:
|
||||
if random.random() * 100 < 10:
|
||||
target = None
|
||||
|
||||
if target is None:
|
||||
targets = [
|
||||
e for e in self.enemies or [] if e.alive and e.size < self.man.size
|
||||
]
|
||||
if targets:
|
||||
if targets := [e for e in self.enemies or [] if e.size < self.man.size]:
|
||||
target = random.choice(targets)
|
||||
|
||||
if target is None:
|
||||
@@ -238,7 +235,6 @@ while running:
|
||||
for p in players:
|
||||
for op in players:
|
||||
if p != op and p.can_eat(op):
|
||||
op.alive = False
|
||||
players.remove(op)
|
||||
|
||||
if p.can_eat(food):
|
||||
|
Reference in New Issue
Block a user