aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/engine/game.py
diff options
context:
space:
mode:
authorPhilip Paquette <pcpaquette@gmail.com>2018-11-02 16:23:52 -0400
committerPhilip Paquette <pcpaquette@gmail.com>2019-04-18 11:18:41 -0400
commitf809b43d34344ba859658469c58d0de1c2110c97 (patch)
tree6f609eb965d5be13249b1bbce0ebe07d0646a9e3 /diplomacy/engine/game.py
parent10efa08dc69f9173dc04738aab96f01b00dcbc8a (diff)
DATC 6.K.2 - Testing support of fleet in failed convoy
Diffstat (limited to 'diplomacy/engine/game.py')
-rw-r--r--diplomacy/engine/game.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/diplomacy/engine/game.py b/diplomacy/engine/game.py
index a71d486..f386c73 100644
--- a/diplomacy/engine/game.py
+++ b/diplomacy/engine/game.py
@@ -3801,12 +3801,18 @@ class Game(Jsonable):
coord = self.command[guy].split()
# 1) Void if support is for hold and guy is moving
+ if len(word) < 5 and coord[0] == '-':
+ self.result[unit] += ['void']
+ continue
+
# 2) Void if support is for move and guy isn't going where support is given
- # 3) Void if support is give, but move over convoy failed
offset = 1 if coord[-1] == 'VIA' else 0
- if ((len(word) < 5 and coord[0] == '-')
- or (len(word) > 4 and (coord[0], coord[-1 - offset]) != ('-', word[4]))
- or 'no convoy' in self.result[guy]):
+ if len(word) > 4 and (coord[0], coord[-1 - offset]) != ('-', word[4]):
+ self.result[unit] += ['void']
+ continue
+
+ # 3) Void if support is giving for army moving via convoy, but move over convoy failed
+ if 'no convoy' in self.result[guy] and guy[0] == 'A':
self.result[unit] += ['void']
continue