effectively print list of used expansions

This commit is contained in:
2023-08-06 23:19:06 +02:00
parent 6d0a752620
commit 3820c41800

View File

@@ -20,6 +20,7 @@ print $form ;
}
else {
$ext=array() ;
$usedExt=array() ;
$cards=array() ;
$csvfile = fopen('cards.csv', "r") or die( "unable to open card file" ) ;
while( $line = fgetcsv( $csvfile ) ){
@@ -62,10 +63,17 @@ else {
echo "first player is: $first <br />";
echo "winner is: $winner<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 ) {
global $usedExt ;
if( $key = array_search( $card, $cards)){
print( $ext[$key]."<br />" ) ;
array_push( $usedExt, $ext[$key] ) ;
}
}