/** * 盤面を描画 * @param array $board * @return void */ function drawBoard($board) { echoConsole(" a b c d e f g h\n"); echoConsole(" ----------------\n"); for ($y = 0; $y < 8; $y++) { echoConsole($y + 1 . "|"); for ($x = 0; $x < 8; $x++) { switch ($board[$x][$y]) { case CELL_BLACK: echoConsole(VIEW_BLACK); break; case CELL_WHITE: echoConsole(VIEW_WHITE); break; default: echoConsole(VIEW_EMPTY); break; } } echoConsole("|\n"); } echoConsole(" ----------------\n"); drawScore($board); }
function editScore(&$smarty) { $select = $_POST['id_round']; $none = true; $tournaments = new tournaments(trim($_REQUEST['id'])); $data = $tournaments->getRoundList(); $key = 0; $mark = 0; foreach ($data as $var) { switch ($var['round_no']) { case 1: $nama = "First"; break; case 2: $nama = "Second"; break; case 3: $nama = "Third"; break; case 4: $nama = "Fourth"; break; case 5: $nama = "Fifth"; break; default: $nama = ""; break; } $list[$key]['param'] = $nama; $list[$key]['value'] = $var['round_id']; $list[$key]['selected'] = ""; if ($select == $var['round_id']) { $list[$key]['selected'] = "selected"; $none = false; $mark = $key; } $key++; } if ($none) { $list[0]['selected'] = "selected"; } $smarty->assign('list', $list); // Get Games ID $id_player = $_REQUEST['sid']; $id_round = $list[$mark]['value']; $games_id = $tournaments->getGamesID($id_round, $id_player); $smarty->assign('games_id', $games_id); drawScore($smarty, $games_id); }