function Play()
{
if (param["mode"]==0) //手を決める
{
var com = Think();
document.write('<form action="jyanken4.html" method="get">');
document.write('<input type="hidden" name="mode" value=1>');
document.write('<input type="hidden" name="score_m" value=',param["score_m"],'>');
document.write('<input type="hidden" name="score_c" value=',param["score_c"],'>');
document.write('<input type="hidden" name="cnt" value=',param["cnt"],'>');
document.write('<input type="hidden" name="v1" value=',param["v1"],'>');
document.write('<input type="hidden" name="v2" value=',param["v2"],'>');
document.write('<input type="hidden" name="com" value=',com,'>');
document.write('<input type=radio name="man" value=0 CHECKED>グー <br><br>');
document.write('<input type=radio name="man" value=1>チョキ<br><br>');
document.write('<input type=radio name="man" value=2>パー <br><br><br>');
document.write('<input type=radio name="man" value=3>END<br><br>');
document.write('<br><input type="submit" value="送信">');
document.write('</form>');
return;
}
if (param["mode"]==1) //勝負の判定
{
if (param["man"]==3) location.href = "game_index.html";
else
{ var man = param["man"];
var com = param["com"];
var s_m = param["score_m"];
var s_c = param["score_c"];
document.write('<h2>あなた : わたし</h2>');
if (man==0) document.write('<img src="jgu.gif">');
if (man==1) document.write('<img src="jchi.gif">');
if (man==2) document.write('<img src="jpa.gif">');
if (com==0) document.write('<img src="jgu.gif">');
if (com==1) document.write('<img src="jchi.gif">');
if (com==2) document.write('<img src="jpa.gif">');
var w = ((man+3)-com)%3;
switch(w)
{ case 1: // Computer の勝ち
document.write('<h2>私の勝ちです</h2>');
switch(com)
{ case 0: //グーで勝ち
s_c += 5;
break;
case 1: //チョキで勝ち
s_c += 2;
break;
case 2: //パーで勝ち
s_c += 15;
s_m -= 5;
break;
}
break;
case 2: // プレイヤー の勝ち
document.write('<h2>あなたの勝ちです</h2>');
switch(man)
{ case 0: //グーで勝ち
s_m += 5;
break;
case 1: //チョキで勝ち
s_m += 2;
break;
case 2: //パーで勝ち
s_m += 15;
s_c -= 5;
break;
}
break;
default:
document.write('<h2>あいこです</h2>');
switch(com)
{ case 0: //グー
s_m += 3;
s_c += 3;
break;
case 1: //チョキ
s_m += 1;
s_c += 1;
break;
}
break;
}
Info(); //情報の収集
document.write('<table border="1">');
document.write('<tr><th>あなたの得点</th><th>わたしの得点</th></tr>');
document.write('<tr><td>',s_m,'</td><td>',s_c,'</td></tr>');
document.write('</table>');
document.write('<form action="jyanken4.html" method="get">');
document.write('<input type="hidden" name="mode" value=0>');
document.write('<input type="hidden" name="score_m" value=',s_m,'>');
document.write('<input type="hidden" name="score_c" value=',s_c,'>');
document.write('<input type="hidden" name="cnt" value=',(param["cnt"]+1),'>');
document.write('<input type="hidden" name="v1" value=',param["v1"],'>');
document.write('<input type="hidden" name="v2" value=',param["v2"],'>');
document.write('<br><br><input type="submit" value="確認">');
document.write('</form>');
}
}
}
|