Example #1
0
function exists_murder_card($type)
{
    foreach (select_cards(array("type" => $type)) as $card) {
        if (count(select_with_request_string("player", "owned", array("game", "player", "card", "status"), array(), array("game" => game, "card" => $card["id"], "status" => not_owned))) == count(select_suspects())) {
            return true;
        }
    }
    return false;
}
Example #2
0
 case "index":
     break;
 case "new":
     break;
 case "create":
     define("game", create_game($_POST["identity"]));
     define("turn", -1);
     foreach ($_POST["cards_suspect"] as $suspect => $cards) {
         create_player($suspect, $cards);
     }
     foreach ($_POST["known_cards"] as $card) {
         add_card_owner_status($card, $_POST["identity"], owned);
     }
     foreach (select_suspects() as $player) {
         if (select_cards_player($player["id"]) == 0) {
             foreach (select_cards() as $card) {
                 add_card_owner_status($card["id"], $player["id"], not_owned);
             }
         }
     }
     $game["id"] = game;
     redirect_to_action("show");
     break;
 case "turn":
     define("turn", create_turn($_POST));
     set_if_not_set($_POST["witness"], get_current_player());
     foreach (players_between(get_current_player(), $_POST["witness"]) as $player) {
         add_card_owner_status($_POST["weapon"], $player, not_owned);
         add_card_owner_status($_POST["room"], $player, not_owned);
         add_card_owner_status($_POST["suspect"], $player, not_owned);
     }
Example #3
0
function select_rooms()
{
    return select_cards(array("type" => room));
}