Visa källkod
Nedanstående filer finns i denna katalog. Klicka på en fil för att visa dess innehåll.
- .buildpath
- .project
- CCard.php
- CCardHand.php
- CDeck.php
- argyle.jpg
- card.php
- common.php
- deck.php
- grunge.jpg
- hand.php
- index.php
- sessDest.php
- sessions.php
- sessions_mroos.php
- source.php
- template.php
- tiles.jpg
Stäng "hand.php"
<?php
// ===============================================================
// Contents: Kortgrejer.
// Author: Staffan Lindsgård
// ===============================================================
$pagetitle = "Kortelikort!";
$customhead = "";
require_once "common.php";
echo $page_top;
// ===============================================================
// Inkluderar externa PHP-filer.
require_once "CCard.php";
require_once "CDeck.php";
require_once "CCardHand.php";
// ===============================================================
// Inställningar för felsökning.
error_reporting(-1);
$debug = true;
$debug = (empty($_POST['debug']) ? $debug : $_POST['debug']);
$debug = ($debug=="true" ? true : false);
$debug_out = "<h2 class='debug'>Debug</h2>\n";
// ===============================================================
// XX
// Vi skapar en ny kortlek och blandar den.
$deck = new CDeck();
$deck->Shuffle();
$hand1 = new CCardHand();
$hand2 = new CCardHand();
// Sedan drar vi de fem översta korten, placerar dem i vår hand och tittar på dem.
$html = "<h2>Min hand...</h2>\n";
for($i=0;$i<5;$i++) {
$card = $deck->DealFromTop();
$card->FlipCard();
$hand1->AddCard($card);
}
$html .= $hand1->GetHandAsCSS();
// Vi drar nästa fem kort och tittar.
$html .= "<h2>Min andra hand...</h2>\n";
for($i=0;$i<5;$i++) {
$card = $deck->DealFromTop();
$card->FlipCard();
$hand2->AddCard($card);
}
$html .= $hand2->GetHandAsCSS();
// Vi tittar på de första fem korten igen.
$html .= "<h2>Min första hand igen...</h2>\n";
$html .= $hand1->GetHandAsCSS();
// Sedan slänger vi hela handen första handen och tittar på den.
$html .= "<h2>Min första hand efter att slängt korten.</h2>\n";
$hand1->DropAllCards();
$html .= $hand1->GetHandAsCSS();
$html .= "\n";
?>
<h1>Då skall vi se på den lilla handen...</h1>
<p>Jaha, där ser man...</p>
<?php echo $html; ?>
<?php echo $debug_out; ?>
<?php
echo $page_bottom;
?>