Skip to content

Instantly share code, notes, and snippets.

@kbutti
Created October 29, 2009 06:52
Show Gist options
  • Select an option

  • Save kbutti/221218 to your computer and use it in GitHub Desktop.

Select an option

Save kbutti/221218 to your computer and use it in GitHub Desktop.
#osak先生の数当てゲーム 普通の生徒用 TAの模範解答
$score = 0;
while(){
for($i=0; $i<=3; ++$i){
$rnd[$i] = int(rand(99));
}
@rnd = sort @rnd;
print "Input 0..99 number->";
my $in = <STDIN>;
if($in >= $rnd[0] && $in <= $rnd[3] ){
$score = $score + 10;
print "Clear! Score=$score\n";
}else{
print "OUT! Score=$score\n";
last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment