Changeset 21172
- Timestamp:
- 10/12/08 16:23:41 (3 months ago)
- Location:
- lang/python/saichugen/gae
- Files:
-
- 4 modified
-
saichugen/main/logic.py (modified) (1 diff)
-
saichugen/main/models.py (modified) (1 diff)
-
saichugen/main/views.py (modified) (6 diffs)
-
template/game.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/saichugen/gae/saichugen/main/logic.py
r21155 r21172 57 57 def to_num(card): 58 58 return card / 4 + 1 59 -
lang/python/saichugen/gae/saichugen/main/models.py
r21165 r21172 9 9 is_single_game = db.BooleanProperty(default=True) 10 10 11 step = db.IntegerProperty(default=0) # 0..14 12 def next_step(self): 13 self.step += 1 14 def get_round(self): 15 return self.step / 3 16 def get_turn(self): 17 return self.step % 3 18 11 19 def update(self, info): 12 20 import cPickle -
lang/python/saichugen/gae/saichugen/main/views.py
r21171 r21172 24 24 #info = req.GET.get("info") 25 25 info = dict( 26 iturn = 0,27 iround = 0,28 26 game_score = [0, 0, 0], 29 27 round_score = [0, 0, 0], … … 59 57 plays = info["plays"] 60 58 for i, xs in enumerate(plays): 61 cur_round = (i >= info["iround"]* 3)59 cur_round = (i >= game.get_round() * 3) 62 60 for p in range(3): 63 61 if (info["winner_of_turn"][i] == p and … … 70 68 71 69 real_log = [[], [], []] 72 for i in range( info["iround"]):70 for i in range(game.get_round()): 73 71 for p in range(3): 74 72 real_log[p].append(log[p][i * 3:i * 3 + 3]) 75 73 76 74 for p in range(3): 77 real_log[p].append(log[p][ info["iround"]* 3:])75 real_log[p].append(log[p][game.get_round() * 3:]) 78 76 79 77 tvalue["real_log"] = real_log … … 108 106 time_log.append(msg) 109 107 tvalue["time_log"] = time_log 110 for key in " iround iturngame_score round_score".split():108 for key in "game_score round_score".split(): 111 109 tvalue[key] = info[key] 112 110 … … 144 142 info["round_score"][winner] += logic.to_num(mid) 145 143 addTimeLog(info, "System", "END_TURN_", 146 ( info["iturn"], info["iturn"] + info["iround"] * 3))147 info["iturn"] += 1144 (game.get_turn(), game.step)) 145 game.next_step() 148 146 149 147 # もしターンIDが3ならラウンド終了処理 150 if info["iturn"] == 3: 151 info["iturn"] = 0 148 if game.get_turn() == 0: 152 149 rs = info["round_score"] 153 150 mid = logic.get_mid(rs) … … 160 157 winner.append(False) 161 158 info["winner_of_round"].append(winner) 162 addTimeLog(info, "System", "END_ROUND", info["iround"])159 addTimeLog(info, "System", "END_ROUND", game.get_round()) 163 160 info["round_score"] = [0, 0, 0] 164 info["iround"] += 1 165 if info["iround"] < 5: 166 addTimeLog(info, "System", "START_ROUND", info["iround"]) 161 if game.get_round() < 5: 162 addTimeLog(info, "System", "START_ROUND", game.get_round()) 167 163 # もしラウンドIDが5ならゲーム終了処理 168 if info["iround"] ==5:164 if game.step == 15: 169 165 game.is_finished = True 170 addTimeLog( game, "System", "END_GAME")166 addTimeLog(info, "System", "END_GAME") 171 167 172 168 game.update(info) -
lang/python/saichugen/gae/template/game.html
r21165 r21172 11 11 {% endif %} 12 12 <hr> 13 Round {{ iround|add:1 }}, turn {{ iturn|add:1 }}.13 Round {{ game.get_round|add:1 }}, turn {{ game.get_turn|add:1 }}. 14 14 Choose a card from your hand: 15 15 <p> … … 23 23 24 24 <hr> 25 盤面状況: 25 26 {% for logi in real_log %} 26 27 <div style="width:150px; float: left;">
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)