From 3820c4180057a50a7d701429cf0520bdc8462797 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Sun, 6 Aug 2023 23:19:06 +0200 Subject: [PATCH] effectively print list of used expansions --- parse.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parse.php b/parse.php index b370a82..9486958 100644 --- a/parse.php +++ b/parse.php @@ -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
"; echo "winner is: $winner
" ; echo "num of turns: $turns
" ; + echo "list of expansions used:" ; + echo "
    " ; + foreach ( array_unique($usedExt) as $e ){ + print( "
  1. ".$e."
  2. " ) ; + } + echo "
" ; } function guessExpansion( $card, $cards, $ext ) { + global $usedExt ; if( $key = array_search( $card, $cards)){ - print( $ext[$key]."
" ) ; + array_push( $usedExt, $ext[$key] ) ; } }