/** * * 检查是否结束。如果已经结束,设置对象属性。此处不进行save操作。 * @param unknown_type $game */ public function checkwin($game) { $moves = strlen($game->game_record) / 2; if ($moves < 9) { return false; } if ($moves == 225) { //和棋 BoardTool::do_over($game, 0.5); return true; } $checkwin = new ForbiddenPointFinder(substr($game->game_record, 0, -2)); $result = $checkwin->CheckWin(substr($game->game_record, -2, 2)); if ($result == BLACKFIVE) { //黑胜 BoardTool::do_over($game, 1); return true; } if ($result == WHITEFIVE || $result == BLACKFORBIDDEN) { //白胜 BoardTool::do_over($game, 0); return true; } return false; }
} } else { echo $v->status; } ?> </td> <td><?php echo $v->rule; ?> </td> <td><?php echo $v->free_opening ? '是' : '否'; if ($step >= 3) { ?> /<?php echo BoardTool::opening_name($v->game_record); } ?> </td> <td class="status"><?php echo $v->status; ?> </td> <td><div style="width:117px;overflow:hidden;white-space:nowrap"><?php if ($v->tid) { echo "<a href='/tournament_{$v->tid}.html' target='_blank'>"; } echo CHtml::encode($v->comment); if ($v->tid) { echo "</a>"; }