From bdd5f5f164e62ccdfe5c83e4eab30f4029606058 Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Sun, 16 Oct 2022 15:29:30 -0700 Subject: Added discarding for focused studying --- flashcards.plx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'flashcards.plx') diff --git a/flashcards.plx b/flashcards.plx index 7671812..bc6e8f2 100755 --- a/flashcards.plx +++ b/flashcards.plx @@ -78,10 +78,20 @@ while($line = <$fh>) { close($fh); # Go through each card (automatically shuffled!) -foreach my $k (keys %cards) { - print "$k\n"; +while(scalar %cards > 0) { + print scalar %cards . " cards remaining\n"; readline(STDIN); - print "$cards{$k}\n"; - readline(STDIN); - print "\n"; + foreach my $k (keys %cards) { + print "$k\n"; + readline(STDIN); + print "$cards{$k}\n"; + + # Check if card should be placed back in deck or discarded + print "Discard? [Y/n] "; + $line = readline(STDIN); + if(!($line =~ /[nN].*/)) { + delete $cards{$k}; + } + print "\n"; + } } -- cgit