したらばTOP ■掲示板に戻る■ 全部 1-100 最新50 | メール | |

ゲーム作らないか?

58KAITさん:2009/01/14(水) 19:17:57
srand(time);
$GUU=0;
$CYOKI=1;
$PAA=2;
$ransuu=int(rand(10));
$count=0;
while($count<$ransuu)
{
&nbsp;&nbsp;rand;
&nbsp;&nbsp;$count++;
}
while(1)
{
&nbsp;&nbsp;print "手を入力してください。\n(0:グー,1:チョキ,2:パー)->";
&nbsp;&nbsp;$input=<STDIN>;
&nbsp;&nbsp;$com=int(rand(3));
&nbsp;&nbsp;if($com==$GUU){ print"コンピュータはグーを出しました。\n";}
&nbsp;&nbsp;elsif($com==$CYOKI){ print "コンピュータはチョキを出しました。\n";}
&nbsp;&nbsp;else{ print"コンピュータはパーを出しました。\n";}
&nbsp;&nbsp;if($input==$GUU)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;if($com==$CYOKI){print"勝ちです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;elsif($com==$PAA){print"負けです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;else {print"アイコです。\n"}
&nbsp;&nbsp;}
&nbsp;&nbsp;elsif($input==$CYOKI)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;if($com==$PAA){print"勝ちです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;elsif($com==$GUU){print"負けです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;else{print"アイコです。\n";}
&nbsp;&nbsp;}
&nbsp;&nbsp;elsif($input==$PAA)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;if($com==$GUU){print"勝ちです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;elsif($com==$CYOKI){print"負けです。\n";}
&nbsp;&nbsp;&nbsp;&nbsp;else{print"アイコです。\n";}
&nbsp;&nbsp;}
}

#Perl版じゃんけんゲーム


新着レスの表示


名前: E-mail(省略可)

※書き込む際の注意事項はこちら

※画像アップローダーはこちら

(画像を表示できるのは「画像リンクのサムネイル表示」がオンの掲示板に限ります)

掲示板管理者へ連絡 無料レンタル掲示板