effectively print list of used expansions
This commit is contained in:
10
parse.php
10
parse.php
@@ -20,6 +20,7 @@ print $form ;
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ext=array() ;
|
$ext=array() ;
|
||||||
|
$usedExt=array() ;
|
||||||
$cards=array() ;
|
$cards=array() ;
|
||||||
$csvfile = fopen('cards.csv', "r") or die( "unable to open card file" ) ;
|
$csvfile = fopen('cards.csv', "r") or die( "unable to open card file" ) ;
|
||||||
while( $line = fgetcsv( $csvfile ) ){
|
while( $line = fgetcsv( $csvfile ) ){
|
||||||
@@ -62,10 +63,17 @@ else {
|
|||||||
echo "first player is: $first <br />";
|
echo "first player is: $first <br />";
|
||||||
echo "winner is: $winner<br />" ;
|
echo "winner is: $winner<br />" ;
|
||||||
echo "num of turns: $turns<br />" ;
|
echo "num of turns: $turns<br />" ;
|
||||||
|
echo "list of expansions used:" ;
|
||||||
|
echo "<ol>" ;
|
||||||
|
foreach ( array_unique($usedExt) as $e ){
|
||||||
|
print( "<li>".$e."</li>" ) ;
|
||||||
|
}
|
||||||
|
echo "</ol>" ;
|
||||||
|
|
||||||
}
|
}
|
||||||
function guessExpansion( $card, $cards, $ext ) {
|
function guessExpansion( $card, $cards, $ext ) {
|
||||||
|
global $usedExt ;
|
||||||
if( $key = array_search( $card, $cards)){
|
if( $key = array_search( $card, $cards)){
|
||||||
print( $ext[$key]."<br />" ) ;
|
array_push( $usedExt, $ext[$key] ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user