Forráskód Böngészése

reorder initialization sequence of game

George C. Privon 7 éve
szülő
commit
a70f3edd98
2 módosított fájl, 11 hozzáadás és 10 törlés
  1. 1 0
      CHANGELOG.md
  2. 10 10
      cgame.py

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@
 #### Enhancements
 
 * Add turn length vs turn number plot to `analysis/SampleAnalysis-SingleGame.ipynb`.
+* Reorder game initilization so that most of the info can be entered before the player order is determined.
 
 ### 0.4.1 (18 November 2018)
 

+ 10 - 10
cgame.py

@@ -93,16 +93,6 @@ class cgame:
         self.tiletypes = []
         self.scoretypes = ["Meadow", "City", "Road", "Monastery"]
 
-        # get players for this game
-        _sys.stdout.write("Collecting player information...\n")
-        while self.getPlayers():
-            continue
-
-        # get expansions used for this game
-        _sys.stdout.write("Collecting expansion information...\n")
-        while self.getExpansions():
-            continue
-
         # get general game info (do this after expansions because
         # expansion info is entered into the game table)
         while self.gameInfo():
@@ -116,6 +106,16 @@ class cgame:
 
         location = input("Where is the game being played? ")
 
+        # get expansions used for this game
+        _sys.stdout.write("Collecting expansion information...\n")
+        while self.getExpansions():
+            continue
+
+        # get players for this game
+        _sys.stdout.write("Collecting player information...\n")
+        while self.getPlayers():
+            continue
+
         starttime = _datetime.utcnow().strftime(self.timefmt)
 
         self.cur.execute('INSERT INTO games (location, starttime, expansions) VALUES ("' + location + '","' + starttime + '","' + ','.join(["{0:d}".format(x) for x in self.expansionIDs]) + '")')