Пример #1
0
    $game = new TicTacToe("o", $board);
    if ($game->terminal()) {
        endgame($game);
    } else {
        $moves = $game->next_states();
        $min = 2;
        $next = $moves[0];
        foreach ($moves as $g) {
            $curr = minimax($g);
            if ($curr <= $min) {
                $next = $g;
                $min = $curr;
            }
        }
        if ($next->terminal()) {
            endgame($next);
        } else {
            $board = $next->board;
            print implode("", $board);
        }
    }
    exit;
}
?>
<html>
<head>
<script type="text/javascript">

var board = "---------";

var playing = true;
                                if ($array['control'] == 'G') {
                                    $Gsup += $array['supply'];
                                } else {
                                    if ($array['control'] == 'L') {
                                        $Lsup += $array['supply'];
                                    } else {
                                        if ($array['control'] == 'T') {
                                            $Tsup += $array['supply'];
                                        } else {
                                            if ($array['control'] == 'M') {
                                                $Msup += $array['supply'];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Ssup}' WHERE name = 'Stark'");
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Bsup}' WHERE name = 'Baratheon'");
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Gsup}' WHERE name = 'Greyjoy'");
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Lsup}' WHERE name = 'Lannister'");
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Msup}' WHERE name = 'Martell'");
                    mysql_query("UPDATE " . $house['house'] . " SET bochki = '{$Tsup}' WHERE name = 'Tyrell'");
                }
            }
        }
    }
} else {
    endgame($game_id);
}