Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a disband order should show distinctly that a power had a forced dislodged/disband not just "disband" #9

Open
duffy-ocraven opened this issue Jul 21, 2020 · 2 comments
Labels
good first issue Good for newcomers

Comments

@duffy-ocraven
Copy link
Owner

duffy-ocraven commented Jul 21, 2020

L1094-20
when in Fall a forced dislodged/disband occurred, but then a skipped Fall Retreats phase, then in the Winter adjustments, the order should somewhere show up, and the "results" expressed not just as "disband"
from ./sccs/games/dipusa/unitTestPureGame.json/5 or 4

":{"count":0,"homes":[]},
"ENGLAND":{"count":0,"homes":[]},
"FRANCE":{"count":0,"homes":[]},
"GERMANY":{"count":0,"homes":[]},
"ITALY":{"count":0,"homes":[]},
"RUSSIA":{"count":0,"homes":[]},
"TURKEY":{"count":1,"homes":["CON"]}},
"game_id":"sc57rv7OKw5kpBtt","map":"pure","rules":["NO_PRESS","POWER_CHOICE"]},
"orders":{"AUSTRIA":[],
"ENGLAND":[],
"FRANCE":[],
"GERMANY":[],
"ITALY":[],
"RUSSIA":[],
"TURKEY":[]},
"results":{"WAIVE":["void"],
"A ROM":["disband"]},
"messages":[]},
{"name":"S1923M","state":{"timestamp":1592954812354022,"zobrist_hash":"4029708752075444226","note":"","name":"S1923M","units":{"AUSTRIA":[],
@duffy-ocraven
Copy link
Owner Author

The resolution of #8 will mask this situation in random orders, so solve this first, or preserve a unitTestScenario.

@duffy-ocraven duffy-ocraven added the good first issue Good for newcomers label Jul 21, 2020
@duffy-ocraven duffy-ocraven changed the title entitled to a build, a disband order should show "void" not "disband" a disband order should show distinctly that a power had a forced dislodged/disband not just "disband" Jul 25, 2020
duffy-ocraven added a commit that referenced this issue Jul 25, 2020
The slightly different loadDiplomacyGame code needed for illustrating #9
@duffy-ocraven
Copy link
Owner Author

Here is the diffs needed in engine/game.py to resolve Issues #9, #10, and #13.

964c965
<         # Skipping VOID and WAIVE orders in Adjustment/Retreats phase
---
>         # Skipping WAIVE orders but preserving VOID in Adjustment/Retreats phase
973c974
<                                 if order and order != 'WAIVE' and order.split()[0] != 'VOID']
---
>                                 if order and order != 'WAIVE'] # and order.split()[0] != 'VOID']
4251a4322,4323
>                     # annotate_move_results
>                     self.result[unit] = ["-> %s" % (new_unit[2:],)]
4265a4344
>                     self.result[unit] += ["disbanded"]
4327a4413,4415
>                           if ("WAIVE" == unit):
>                             self.result.setdefault(unit, []).append(power.name)
>                           else:
4337a4426
>                             self.result.setdefault(unit, []).append("chose disband")
4379c4468
<                         self.result.setdefault(goner, [])
---
>                         self.result.setdefault(goner, ["dislodged/disband"])
4403c4500,4504
<                         self.result[unit] = [VOID]
---
>                         if ('B' == order[-1]):
>                           whichAction = 'B'
>                         else:
>                           whichAction = 'D'
>                         self.result[unit] = ["%s %s void" % (power.name, whichAction)]
4445,4446c4546,4547
<                         diff += 1
<                         self.result[unit] += [OK]
---
>                         diff += 1
>                         self.result[unit] += ["%s builds %s" % (power.name, unit)]
4448c4549
<                         self.result[unit] += [VOID]
---
>                         self.result[unit] += ["%s B void" % (power.name,)]
4457,4458c4558,4559
<                         diff -= 1
<                         self.result[unit] += [OK]
---
>                         diff -= 1
>                         self.result[unit] += ["%s disbands %s" % (power.name, unit)]
4460c4561
<                         self.result[unit] += [VOID]
---
>                         self.result[unit] += ["%s D void" % (power.name,)]
4477c4578
< 
---
>                         self.result[unit] += [word[3]]
4479a4581,4585
>                 elif word[-1] == 'D' and self.phase_type == 'R':
>                   self.dislodged[unit] = word[2] # self.dislodged is one vector for the whole board
>                   #debug print ("bef %s" % (self.result[unit],))
>                   self.result[unit] += [DISBAND]
>                   #debug print ("aft %s" % (self.result[unit],))
4488,4494c4593,4602
<             if DISBAND not in self.result[unit]:
<                 self.result[unit] += [DISBAND]
---
>           if DISBAND in self.result[unit]:
>             self.result[unit] = ["chose disband"]
>           else:
>             self.result[unit] += ["dislodged/disbanded"]

and the needed corresponding change needed to utils/export.py for Issue #10

216,218c220,225
<                         loc = order.split()[1]
<                         if order not in possible_orders[loc]:
<                             return False
---
>                       # exclude the VOID
>                       if ("VOID" == order.split()[0]):
>                         break; # to the next in for order in orders[power_name]:
>                       loc = order.split()[1]
>                       if order not in possible_orders[loc]:
>                         return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant