| <body> <h2>勝負の判定</h2> <script type="text/javascript"> Init(); Check(); Play(); </script> | 
| 
// プレイ関数
function Play()
{
    if (param["mode"]==0)   //手を決める
    {
        var com = Think();
        document.write('<form action="jyanken3.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>');
        document.write('<input type=radio name="man" value=1>チョキ<br>');
        document.write('<input type=radio name="man" value=2>パー<br>');
        document.write('<input type="submit" value="送信">');
        document.write('</form>');
        return;
    }
 | 
| 
    if (param["mode"]==1)   //勝負の判定
    {
        var man = param["man"];
        var com = param["com"];
        var s_m = param["score_m"]; 
        var s_c = param["score_c"];
        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:
                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(com)
                {   case 0: //グーで負け
                        s_m += 15;
                        s_c -= 5;
                        break;
                    case 1: //チョキで負け
                        s_m += 5;
                        break;
                    case 2: //パーで負け
                        s_m += 2;
                        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('<form action="jyanken3.html" method="get">');
        document.write('<input type="hidden" name="mode" value=0>');
        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('<input type="text" name="score_m" value=',s_m,'>');
        document.write('<input type="text" name="score_c" value=',s_c,'>');
        document.write('<input type="submit" value="確認">');
        document.write('</form>');
    }
}
 | 
| 
// コンピュータが考える
function Think()
{
    var n= Math.floor(Math.random()*3);
    return(n);
}
// 情報の収集
function Info()
{
}
</script>
 | 
