jug7.com
[ home / cgi / juggler / column / diary / bbs / link / welcome ]


source : 秘宝伝


#!/usr/bin/perl
# 秘宝伝 シミュレーション

$cginame  = 'hihou.cgi';
$title    = '秘宝伝 シミュレーション';

print "Content-Type: text/html\n\n";

if ($ENV{'REQUEST_METHOD'} eq 'POST') {
    read (STDIN, $input, $ENV{'CONTENT_LENGTH'});

    foreach (split(/&/,$input)) {
        ($name,$value) = split(/=/, $_);
        push(@input, $value);
    }
    ($s, $play, $mode, $s_big, $s_reg, $hazushi, $ten) = @input;
    $def_sbig = $s_big;
    $def_sreg = $s_reg;
    $def_mode = $md = $mode;
    $s_big    = 50 if $s_big eq '';
    $s_reg    = 50 if $s_reg eq '';
    $hazushi  = 10 if $hazushi eq '';

}

$mode    = 1 if !$mode;
$s_big   = 50 if !$s_big;
$s_reg   = 50 if !$s_reg;
$hazushi = 10 if !$hazushi;

# ヘッダとフォームの表示
print <<"__ FORM __";
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html lang='ja'>
<head>
<meta http-equiv='Content-Type' content="text/html; charset=shift_jis">
<title>jug7.com - cgi $title</title>
 <style type="text/css"> <!--
   A:hover {color:#ff0000;}
 --></style>
</head>
<body text='#000000' bgcolor='#ffffff' link='#0000ff' alink='#ff0000' vlink='#0000cc'>
<font size=7><b><font face='Times New Roman,Times'>jug</font><font face='Bookman Old Style,arial black,Helvetica Black'>7</font><font face='Times New Roman,Times'>.com</font></b></font>
<hr color='#00aa00'>
<strong>[ <a href='../index.html'>home</a> / <a href='index.html'>cgi</a> / <a href='../jug/index.html'>juggler</a> / <a href='../column.html'>column</a> / <a href='../diary/index.html'>diary</a> / <a href='bbs.cgi'>bbs</a> / <a href='../link.html'>link</a> / <a href='../intro.html'>welcome</a> ]</strong>
<div align='center'><h2>$title</h2></div>
<hr width='70%'>
<div align='right'>[ <a href='../simu_data_hihou.html'>data</a> / <a href='hihou_memo.html'>memo</a> / <a href='hihou.html'>source</a> ]</div>
<br><br><center>
<form action='$cginame' method='POST'>
<table border=0>
<tr><td>設定</td><td><input type='text' maxlength=1  name='s' size=14 value='$s'></td></tr>
<tr><td>試行ゲーム数</td><td><input type='text' size=14 name='play' maxlength=4 value='$play'></td></tr>
<tr><td>最初のモード</td><td><input type='text' size=14 name='mode' maxlength=1 value='$mode'></td></tr>
<tr><td>最初のストック数</td><td>B <input type='text' size=2 name='s_big' maxlength=3 value='$s_big'>
 R <input type='text' size=2 name='s_reg' maxlength=3 value='$s_reg'></td></tr>
<tr><td>BIG中ハズシ</td><td>残り <input type='text' size=2 name='hazushi' maxlength=2 value='$hazushi'> P
 からJACIN優先。</td></tr>
</table><br>
<input type='submit' value="開始">
</form>
<table border=0><tr><td>
<font size=2>設定は 1 〜 6 までの数値を入力。<br>
<br>
モードは 1〜3 までを入力。 <b>1</b> 通常  <b>2</b> 伝説ショート  <b>3</b> 伝説ロング<br>
<br>
最初のストック数はBRともに 255個 まで。ストック数が無記入の場合はそれぞれ50個にした。<br>
</font>
</td></tr></table>
</center><br>
__ FORM __


# エラーチェックとGET
if ($play > 9999)  { $error = 1; $er_msg = 'プレイ数は最大9999Pまでです。'; }
if (!$s or !$play) { $error = 1; $er_msg = '記入漏れがあります。'; }
if ($s<0 or $s>6) { $error = 1; $er_msg = '設定は 1 から 6 までです。'; }
if ($mode<=0 or $mode>3) { $error = 1; $er_msg = 'モードは 1 から 3 までです。'; }
if (grep { /[^\d]/ } ($s, $play, $s_big, $s_reg)) { $error = 1; $er_msg = '不適切な文字が記入されています。'; };
if ($s_big>255 or $s_reg>255) {  $error = 1; $er_msg = 'ストック数はBRともに255個までです。'; }

if ($ENV{'REQUEST_METHOD'} ne 'POST') { $error = 1; $er_msg = 0; }
if ($er_msg) {
    print q{<center><b><font color='red' size=4>*** ERROR !! ***</font><br><br>},"\n";
    print "$er_msg</b></center>\n";
}
if ($error) {
    print '<br><br><br><br><br>';
    print q{<div align='right'>[ <a href='../simu_data_hihou.html'>data</a> / <a href='hihou_memo.html'>memo</a> / <a href='hihou.html'>source</a> ]</div>};
    print q{<strong>[ <a href='../index.html'>home</a> / <a href='index.html'>cgi</a> / <a href='../jug/index.html'>juggler</a> / <a href='../column.html'>column</a> / <a href='../diary/index.html'>diary</a> / <a href='bbs.cgi'>bbs</a> / <a href='../link.html'>link</a> / <a href='../intro.html'>welcome</a> ]</strong>};
    print '</body></html>';
    exit;
}


# 通常時小役データ 総数は 65536
$big    = 275;
@reg    = (274, 274, 274, 274, 274, 275); $reg = $reg[$s-1];

$rep    = 8980;
$reprt  = 55536;
@haz    = (477, 477, 477, 477, 227, 26);  $haz = $haz[$s-1];
@bell   = (7250, 7250, 7250, 7250, 7500, 7700);       $bell  = $bell[$s-1];
$che    = 1024;
$suika  = 700;

# BIG中小役確率 /65536
@big_bell  = (37000,37500, 38000, 38500, 39000, 39500);  $big_bell   = $big_bell[$s-1];
@big_suika = (2000, 2200, 2400, 2600, 2800, 3000);       $big_suika  = $big_suika[$s-1];
@big_haz   = (6764, 6064, 5364, 4664, 3964, 3264);       $big_haz    = $big_haz[$s-1];
$big_jac   = 17724;
$big_che   = 2048;
# jac_haz  = 1;  # JACハズレ

# チャンス目 w = weak, s = strong /55536
@w_chance1 = (990, 1045, 1090, 1145, 1166, 1220);  $w_chance1 = $w_chance1[$s-1]; # 非高確
@s_chance1 = (40, 50, 60, 72, 80, 90);  $s_chance1 = $s_chance1[$s-1]; # 非高確
$w_chance2 = $s_chance2 = 1150; # 高確


### モード移行・高確突入 ###
# mode1 滞在時 弱チャンス目
@high_wch1 = (80, 83, 87, 90, 91, 99); #/256  高確当選 ()内は設定順
@mt1_wch1  = (201, 55, 0);             #/256 高確当選時の伝説移行抽選   (通常、伝説ショート、伝説ロング)
@mt1_wch2  = (254, 1, 1);              #/256 高確非当選時の伝説移行抽選 (通常、伝説ショート、伝説ロング)
if ($s<=5)    { @mt1_wch3  = (192,64,0); } # チャンスゾーン中 設定 6 以外
elsif ($s==6) { @mt1_wch3  = (128, 0, 128); } # 設定 6
# mode1 滞在時 強チャンス目
@high_sch1 = (192, 64);                #/256 (高確当選+モード移行抽選強, ボーナス放出+モード移行抽選弱)

# mode2 (伝説ショート)滞在時 弱チャンス目
$m2_wch1  = 96;  #/256 伝説ショート時の弱チャンス目からは 96/256 で高確当選
@mt2_wch1 = (0, 224, 32);  #/256 高確当選時の伝説移行抽選  (通常、ショート、ロング)
@mt2_wch2 = (0, 224, 32);  #/256 高確非当選時の伝説移行抽選
if ($s<=5)    { @mt2_wch3  = (0, 192, 64); }   # チャンスゾーン中 設定 6 以外  64/256 でロングへ
elsif ($s==6) { @mt2_wch3  = (0, 128, 128); }  # 設定 6   128/256 でロングへ
# mode2 (伝説ショート)滞在時 強チャンス目
@m2_sch1 = (128, 128); #/256 (ボーナス放出+ロング抽選、高確当選+ロング抽選)ロング移行抽選 = 1/8でロングへ

# mode3 (伝説ロング)滞在時 弱チャンス目
@m3_wch1 = (32, 96, 128); #/256 (ボーナス放出、高確当選、何も無し)
# mode3 (伝説ロング)滞在時 強チャンス目
@m3_sch1 = (192, 64); #/256 (ボーナス放出、高確当選)

# ボーナス放出時のモード移行抽選
# @b_rel_trans_1 = (170, 68, 18); #/256 M1 BIG
# @b_rel_trans_2 = (1, 207, 48); # M2 BIG
# @b_rel_trans_3 = (1, 0, 255); # M3 BIG
# @r_rel_trans_1 = (208, 48, 0); # M1 REG
# @r_rel_trans_2 = (1, 254, 1); # M2 REG
# @r_rel_trans_3 = (1, 0, 255); # M3 REG

# 高確率プレイ数振り分け
# @high_play = (192, 56, 8); #/256  (10P, 20P, 255P)

# 高確当選時の潜伏プレイ数振り分け(チャンス目時)
# @high_wait1 = (32, 64, 64, 96); #/256  (0P, 3P, 4P, 8P)
# 高確当選時の潜伏プレイ数振り分け(通常出目B時)
# @high_wait2 = (64, 96, 80, 16); #/256  (0P, 4P, 6P, 32P)
# チャンス目からのボーナス放出時の潜伏プレイ数振り分け
# @bonus_rel_wait = (32, 16, 32, 176); #/256  (0P, 3P, 4P, 8P)

if ($s_big && !$s_reg)    { $next_bonus=1; } # next_bonus ==1(BIG), ==2(REG)
elsif (!$s_big && $s_reg) { $next_bonus=2; }
else { $r = int(rand(256)+1); $next_bonus = ($r<=128) ? 1 : 2; }
$ten = 1200 if !$ten;

print <<"__ HTML __";
<br><br><table border=1 align='center' cellspacing=0><caption>シミュレーション結果 <span style='background-color:#ffff88'>背景が黄色の部分は伝説モード中</span>  BIG中 = プレイ数-スイカ-ハズレ</caption>
<tr align='center' bgcolor='#ffffcc'><td><font size=2>ゲーム数</font></td><td><font size=2>当選</font></td>
<td><font size=2>高確率(契機役)・モード移行<br>ボーナス放出(契機役)・他</font></td><td><font size=2>BIG獲得</font></td><td><font size=2>モード</font></td>
<td><font size=2>BIG<br>回数</font></td><td><font size=2>REG<br>回数</font></td><td>BIG中</td><td><font size=2>ストック数</font></td>
<td><font size=2>投資</font></td><td><font size=2>コイン</font></td><td><font size=2>総ゲーム数</font></td></tr>
__ HTML __


#----------------------
#  シミュレート開始
#----------------------

# $high==1 なら高確状態  $pre_high==1 で高確潜伏状態  $pre_bonus==1 でボーナス潜伏状態

$g = $count = $bigcount = $regcount = $coin = $high = $pre_high = $pre_bonus = $rt_cancel = 0;
$high_count = $high_play_count = $high_rel = $wch_count = $sch_count = 0;
$big_play = $big_suika_count = $big_haz_count = 0;
@msg=();
$bigget = ' ';
$hazushi2 = 30 - $hazushi;


while (1) {

    $g++; $count++;
    if ($coin < 3) { $coin += 50; $k++; $totalk++; }
    $coin -= 3;

    if ($pre_high) { $wait_high--; }
    if ($pre_high && $wait_high<=0) { # 高確発動
        $high=1; $pre_high=0; $high_count++;
        $r = int(rand(256)+1);
        $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
        $high_play_d = $high_play -1;
        if ($mode==1) { push(@msg, "<font size=2>$count P 高確率 $high_play_d ($point)</font>"); }
        else { push(@msg, "<font size=2 style=\'background-color:#ffff88\'>$count P 高確率 $high_play_d ($point)</font>"); }
    }
    if ($high_play) { $high_play--; }
    if ($high && !$high_play) { $high=0; }

    if ($pre_bonus && $wait_bonus) { $wait_bonus--; }
    if ($pre_bonus && $wait_bonus<=0) { $rt_cancel = 1; $pre_bonus = 0; }

    if (!$pre_high && !$high) { $ten--; }
    if ($ten<=0) { $rt_cancel = 1; $ten=100; push(@msg, '<font color=\'blue\' size=2>天井到達…</font>'); }

    if ($high) { $high_play_count++; }
    if (!$pre_high && !$high && !$pre_bonus) { $n_play_count++; }


    $repr = (($s_big or $s_reg) && !$rt_cancel) ? $reprt : $rep;
    $r    = int(rand(65536)+1);

    if ($r <= $repr) { # リプレイ(内部リプレイ)
        if ((!$s_big && !$s_reg) or $rt_cancel) { $coin += 3; next; } # ストックなし or ボーナス確定
        else { # RT中の内部リプレイ
            $r = int(rand(65536)+1);
            if ($high==0) { ###  通常時(非高確) ###
                if ($r <= 7740) {  # 通常出目B
                    if ($pre_high or $pre_bonus) { next; }
                    $r = int(rand(256)+1);
                    if ($mode==1) {   # mode1 なら 1/256 で高確抽選
                        if ($r == 33) {
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_b();
                            $point = '通常出目B';
                        }
                    } elsif ($mode==2) { # mode2 なら、高確抽選、伝説転落抽選
                        if ($r <= 170) {
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_b();
                            $point = '通常出目B';
                        } elsif ($r <= 224) {  # 54, 170+54=224  伝説から転落
                            $mode = 1; push(@msg, "<font size=2 color=\'blue\'>( $count P 伝説ショート転落 )</font>");
                        } elsif ($r <= 231 && $s<=5) { # 設定5以下 61/256,  設定6 は 54 /256 で転落
                            $mode = 1; push(@msg, "<font size=2 color=\'blue\'>( $count P 伝説ショート転落 )</font>");
                        }
                    } else { # mode3 なら、高確抽選、伝説転落抽選
                        if ($r <= 170) {
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_b();
                            $point = '通常出目B';
                        } elsif ($r <= 195) { # 設定5以下 25/256,  設定6 は 39 /256 で転落
                            $mode = 1; push(@msg, "<font size=2 color=\'blue\'>( $count P 伝説ロング転落 )</font>");
                        } elsif ($r <= 209 && $s==6) {
                            $mode = 1; push(@msg, "<font size=2 color=\'blue\'>( $count P 伝説ロング転落 )</font>");
                        }
                    }
                } elsif ($r <= 18364) {  # 揃うリプレイ 10624,  7740+10624=18364
                    $coin += 3; next;
                } elsif ($r<= 18364+$w_chance1) {  # 弱チャンス目
                    if ($pre_high or $pre_bonus) { next; }
                    $wch_count++;
                    $r = int(rand(256)+1);
                    if ($mode==1) {
                        $wch_m1_count++;
                        if ($r <= $high_wch1[$s-1]) {  # 高確当選 + モード移行強
                            $pre_high = 1; $m1_ch_count++; # 高確当選
                            $wait_high = &wait_high_play_c();
                            $point = '弱チャンス目';
                            $r = int(rand(256)+1);
                            @tbl = ($ten>=220 && $ten<=299) ? @mt1_wch3 : @mt1_wch1;
                            $new_mode = &mode_trans(1,@tbl) + 1;
                            $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 弱チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                            $mode = $new_mode;
                        } else {
                            $r = int(rand(256)+1);
                            @tbl = ($ten>=220 && $ten<=299) ? @mt1_wch3 : @mt1_wch2;
                            $new_mode = &mode_trans(1,@tbl) + 1;
                            $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 弱チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                            $mode = $new_mode;
                        }
                    } elsif ($mode==2) {
                        if ($r <= $m2_wch1) { # 高確当選
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_c();
                            $point = '弱チャンス目';
                        } elsif ($r <= $m2_wch1+32) { # ボーナス放出
                            $pre_bonus = 1;
                            $wait_bonus = &wait_bonus_rel();
                        }
                        # 伝説ロング昇格抽選
                        $r = int(rand(256)+1);
                        @tbl = ($ten>=220 && $ten<=299) ? @mt2_wch3 : @mt2_wch2;
                        $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                        $new_mode = &mode_trans(1,@tbl) + 1;
                        if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 弱チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                        $mode = $new_mode;
                    } else { # mode3
                        if ($r <= 32) { # ボーナス放出
                            $pre_bonus = 1;
                            $wait_bonus = &wait_bonus_rel();
                        } elsif ($r <= 128) { # 高確当選 96, 32+96=128
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_c();
                            $point = '弱チャンス目';
                        }
                    }
                } elsif ($r<= 18364+$w_chance1+$s_chance1) {  # 強チャンス目
                    if ($pre_high or $pre_bonus) { next; }
                    $sch_count++;
                    $r = int(rand(256)+1);
                    if ($mode==1) {
                        if ($r <= 192) { # 高確当選 + モード移行強
                            $pre_high = 1; # 高確当選
                            $wait_high = &wait_high_play_c();
                            $point = '<font color=\'red\'>強チャンス目</font>';

                            $r = int(rand(256)+1);
                            @tbl = ($ten>=220 && $ten<=299) ? @mt1_wch3 : @mt1_wch1;
                            $new_mode = &mode_trans(1,@tbl) + 1;
                            $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 強チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                            $mode = $new_mode;
                        } else { # ボーナス放出 + モード移行弱
                            $pre_bonus = 1;
                            $wait_bonus = &wait_bonus_rel();

                            $r = int(rand(256)+1);
                            @tbl = ($ten>=220 && $ten<=299) ? @mt1_wch3 : @mt1_wch2;
                            $new_mode = &mode_trans(1,@tbl) + 1;
                            $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 強チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                            $mode = $new_mode;
                        }
                    } elsif ($mode==2) {
                        if ($r <= 128) { # 高確当選
                            $pre_high = 1;
                            $wait_high = &wait_high_play_c();
                            $point = '<font color=\'red\'>強チャンス目</font>';
                        } else { # ボーナス放出
                            $pre_bonus = 1;
                            $wait_bonus = &wait_bonus_rel();
                        }
                        # ロング移行抽選
                        $r = int(rand(256)+1);
                        @tbl = ($ten>=220 && $ten<=299) ? @mt2_wch3 : @mt2_wch2;
                        $new_mode = &mode_trans(1,@tbl) + 1;
                        $cz = ($ten>=220 && $ten<=299) ? '(CZ中)' : '';
                        if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>( $count P 強チャ目からmode $new_mode へ昇格 $cz )</font>"); }
                        $mode = $new_mode;

                    } else { # mode3
                        if ($r <= 192) { # ボーナス放出
                            $pre_bonus = 1;
                            $wait_bonus = &wait_bonus_rel();
                        } else { # 高確当選
                            $pre_high = 1;
                            $wait_high = &wait_high_play_c();
                            $point = '<font color=\'red\'>強チャンス目</font>';
                        }
                    }
                }  # それ以外は通常出目A
            } else { ###  高確中  ###
                if ($r <= 7740) {  # 通常出目B
                    $r = int(rand(256)+1);
                    if ($r <= 82) { # 82/256 でボーナス放出
                        $pre_bonus = 1; $wait_bonus = 0; $high_rel++;
                    }
                } elsif ($r <= 18364) {  # 揃うリプレイ 10624,  7740+10624=18364
                    $coin += 3; next;
                } elsif ($r<= 18364+$w_chance2) {  # 弱チャンス目 : ボーナス放出
                    $pre_bonus = 1; $wait_bonus = 0; $high_rel++;
                } elsif ($r<= 18364+$w_chance2+$s_chance2) {  # 強チャンス目 : ボーナス放出
                    $pre_bonus = 1; $wait_bonus = 0; $high_rel++;
                }  # それ以外は通常出目A
            }
        }
    } elsif ($r <= $repr+$bell) { $coin += 7; $bell_count++; next; }            # bell
    elsif ($r <= $repr+$bell+$che) { $coin += 4; next; }         # che
    elsif ($r <= $repr+$bell+$che+$suika) { $coin += 15; next; } # suika
    elsif ($r <= $repr+$bell+$che+$suika+$big) {                 # 内部BIG
        if ($s_big<255) { $s_big++; }
        if ($s_big==1 && !$s_reg) { $mode=1; $ten=5; $next_bonus=1; $rt_cancel=0; } # 初ストック時
    } elsif ($r <= $repr+$bell+$che+$suika+$big+$reg) {          # 内部REG
        if ($s_reg<255) { $s_reg++; }
        if (!$s_big && $s_reg==1) { $mode=1; $ten=1200; $next_bonus=2; $rt_cancel=0; } # 初ストック時
    } # それ以外はハズレ (RT中でもとくに何もなし)



    # RT 解除
    if ($rt_cancel) {
        # 通常プレイから内部ストックナシでここに来てしまった場合はリターン
        if (!$s_big && !$s_reg) { $rt_cancel = 0; next; }

        $rt_cancel = $pre_high = $pre_bonus = $high = $wait_bonus = 0;
        # 放出ボーナス  1:BIG  2:REG
        if ($next_bonus==1) { # BIG
            $bigcount++; $s_big--;
            $bonus_d = "<font color='red' face='Arial black'><strong>777</strong></font>";

            # BIG中プレイ開始
            for ($i=1; $i<=30; $i++) {
                $r = int(rand(65536)+1);
                $bigget -= 3; $big_play++;
                if ($r <= $big_bell) { $bigget += 7; } # ベル
                elsif ($r <= ($big_bell+$big_jac)) {    # JACIN
                    if (($jacin<2) or ($jacin==2 && $i>$hazushi2)) {
                        $bigget += 1; $jacin++;

                        for (1..12) { # JAC中
                            $r = int(rand(65536)+1);
                            if ($r == 22222 && !$big_sp) { # JAC ハズレ
                                $bigget -= 1;
                                $r = int(rand(65536)+1);
                                if ($r<=2556) { # RT解除
                                    $big_sp = 1; $pre_bonus = 1; $wait_bonus = &wait_bonus_rel();
                                    push(@msg, "<font color=\'red\' size=2><b>BIG中 JACハズレでRT解除</b></font>");
                                } else { # BET高確
                                    $big_sp = 1; $pre_high = 1; $point = 'BIG中JACハズレ'; $r = int(rand(256)+1);
                                    $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
                                    $high_play_d = $high_play -1;
                                    push(@msg, "<font size=2 color=\'red\'>BIG中 JACハズレでBET高確率 $high_play_d</font>");
                                }
                                next;
                            } else { $bigget += 14; $jacplay++; }
                            if ($jacplay == 8)  { $jacplay = 0; last; }
                        }
                        last if ($jacin==3);
                    } else { next; }
                } elsif ($r <= ($big_bell+$big_jac+$big_haz)) { # BIG中 ハズレ
                    $r = int(rand(65536)+1); $big_haz_count++;
                    if ($r<=256 && !$big_sp) { # RT解除
                        $big_sp = 1; $pre_bonus = 1;  $wait_bonus = &wait_bonus_rel();
                        push(@msg, "<font color=\'red\' size=2><b>BIG中 ハズレでRT解除</b></font>");
                    } elsif ($r<= 2048 && !$big_sp) { # BET高確
                        $big_sp = 1; $pre_high = 1; $point = 'BIG中ハズレ'; $r = int(rand(256)+1);
                        $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
                        $high_play_d = $high_play -1;
                        push(@msg, "<font size=2 color=\'red\'>BIG中 ハズレでBET高確率 $high_play_d</font>");
                    }
                } elsif ($r <= ($big_bell+$big_jac+$big_haz+$big_che)) { # チェリー 
                    $bigget += 4;
                    $r = int(rand(65536)+1);
                    if ($r<=2048 && !$big_sp) { # RT解除
                        $big_sp = 1; $pre_bonus = 1;  $wait_bonus = &wait_bonus_rel();
                        push(@msg, "<font color=\'red\' size=2><b>BIG中 強チェリーでRT解除</b></font>");
                    } elsif ($r<= 16384 && !$big_sp) { # BET高確
                        $big_sp = 1; $pre_high = 1; $point = 'BIG中強チェリー'; $r = int(rand(256)+1);
                        $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
                        $high_play_d = $high_play -1;
                        push(@msg, "<font size=2 color=\'red\'>BIG中 強チェリーでBET高確率 $high_play_d</font>");
                    }
                } else { # スイカ
                    $bigget += 15; $big_suika_count++;
                    $r = int(rand(65536)+1);
                    if ($r<=20 && !$big_sp) { # RT解除
                        $big_sp = 1; $pre_bonus = 1;  $wait_bonus = &wait_bonus_rel();
                        push(@msg, "<font color=\'red\' size=2><b>BIG中 強スイカでRT解除</b></font>");
                    } elsif ($r<= 512 && !$big_sp) { # BET高確
                        $big_sp = 1; $pre_high = 1; $point = 'BIG中強スイカ'; $r = int(rand(256)+1);
                        $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
                        $high_play_d = $high_play -1;
                        push(@msg, "<font size=2 color=\'red\'>BIG中 強スイカでBET高確率 $high_play_d</font>");
                    }
                }
            }
            $bigget += 15; $coin += $bigget; push(@bigget, $bigget);
            $ten = 1200;

            # モード移行抽選
            $r = int(rand(256)+1);
            if ($mode==1) {
                if ($r<=68) { $new_mode = 2; }    # 68
                elsif ($r<=86) { $new_mode = 3; } # 18
                else { $new_mode = 1; }
            } elsif ($mode==2) {
                if ($r<=48) { $new_mode = 3; }      # 48
                elsif ($r==120) { $new_mode = 1; } # 1
                else { $new_mode = 2; }
            } else {
                if ($r==120) { $new_mode = 1; } else { $new_mode = 3; }
            }
            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>BIG放出でモード移行 $mode → $new_mode</font>"); }
            $mode = $new_mode;
        } else { # REG
            $regcount++; $s_reg--;
            $bonus_d = "<strong>REG</strong>";

            for (1..12) {
                $r = int(rand(65536)+1);
                if ($r == 22222) { # JAC ハズレ
                    $regget -= 1;
                    $r = int(rand(65536)+1);
                    if ($r<=2556) { # RT解除
                        $big_sp = 1; $pre_bonus = 1;  $wait_bonus = &wait_bonus_rel();
                        push(@msg, "<font color=\'red\' size=2><b>REG中 JACハズレでRT解除</b></font>");
                    } else { # BET高確
                        $big_sp = 1; $pre_high = 1; $point = 'REG中JACハズレ'; $r = int(rand(256)+1);
                        $high_play = ($r<=192) ? 11 : ($r<= 248) ? 21 : 256;
                        $high_play_d = $high_play -1;
                        push(@msg, "<font size=2 color=\'red\'>REG中 JACハズレでBET高確率 $high_play_d</font>");
                    }
                    next;
                } else { $regget += 14; $jacplay++; }
                if ($jacplay == 8)  { $jacplay = 0; last; }
            }
            $coin += $regget + 1;
            $ten = 900;

            # モード移行抽選
            $r = int(rand(256)+1);
            if ($mode==1) {
                if ($r<=48) { $new_mode = 2; }    # 48
                else { $new_mode = 1; }
            } elsif ($mode==2) {
                if ($r==120) { $new_mode = 3; }    # 1
                elsif ($r==240) { $new_mode = 1; } # 1
                else { $new_mode = 2; }
            } else {
                if ($r==120) { $new_mode = 1; } else { $new_mode = 3; }
            }
            if ($mode != $new_mode) { push(@msg, "<font size=2 color=\'red\'>REG放出でモード移行 $mode → $new_mode</font>"); }
            $mode = $new_mode;
        }

        # 次回ボーナスの抽選
        if ($s_big && !$s_reg)    { $next_bonus=1; }
        elsif (!$s_big && $s_reg) { $next_bonus=2; }
        else { $r = int(rand(256)+1); $next_bonus = ($r<=128) ? 1 : 2; }

        $k = ($k > 0) ? $k.'k' : ' ';

        $opt  = ($count < 150) ? '<b><font color=\'blue\'>' : ($count >=600) ? '<b><font color=\'red\'>' : '';
        $optc = ($count < 150) ? '</font></b>'              : ($count >=600) ? '</font></b>'             : '';
        if ($new_mode==2) { $opt2 = '<font color=\'blue\'>'; $opt2c = '</font>'; }
        elsif ($new_mode==3) { $opt2 = '<font color=\'red\'><b>'; $opt2c = '</b></font>'; } else { $opt2=$opt2c=''; }

        if ($bigcount) { $b_prob = int($g/$bigcount+0.5); $b_prob = "(1/$b_prob)"; }
        if ($regcount) { $r_prob = int($g/$regcount+0.5); $r_prob = "(1/$r_prob)"; }
        $msg = ($#msg>=1) ? join('<br>', @msg) : ($#msg==0) ? $msg[0] : ' ';

        print "<tr align='center'><td>$opt $count $optc</td><td>$bonus_d</td><td>$msg</td><td>$bigget</td>";
        print "<td>$opt2 $mode $opt2c</td><td><font color='blue'>$bigcount</font> $b_prob</td>";
        print "<td><font color='blue'>$regcount</font> $r_prob</td><td>$big_play-$big_suika_count-$big_haz_count<td>B $s_big R $s_reg</td>";
        print "<td>$k</td><td>$coin</td><td>$g</td></tr>\n";

        $k = ''; $count = 0; @msg = (); $bigget = ' '; $regget = 0;
        $jacin = $big_sp = $wait_high = 0;
    }

    if ($g >= $play) {
        $k = ($k > 0) ? $k.'k' : ' ';
        $msg = ($#msg>=1) ? join('<br>', @msg) : ($#msg==0) ? $msg[0] : ' ';
        if ($bigcount) { $b_prob = int($g/$bigcount+0.5); $b_prob = "(1/$b_prob)"; }
        if ($regcount) { $r_prob = int($g/$regcount+0.5); $r_prob = "(1/$r_prob)"; }

        print "<tr align='center'><td>$count</td><td>ヤメ</td><td>$msg</td><td> </td><td> </td>";
        print "<td><font color='blue'>$bigcount</font> $b_prob</td><td><font color='blue'>$regcount</font> $r_prob</td>";
        print "<td>$big_play-$big_suika_count-$big_haz_count</td><td>B $s_big R $s_reg</td><td>$k</td><td>$coin</td><td>$g</td></tr>\n";
        last;
    }
}

# シミュデータの整理
$toushi = $totalk * 1000;
$kankin = $coin * 20;
$shushi = $kankin - $toushi;
$opt3   = ($shushi >= 0) ? 'blue' : 'red';
$payout = ($coin-($totalk * 50))/($g * 3)*100+100;
$payout = &point($payout,2);
if ($bigcount) { $b_prob = &point(($g/$bigcount),3); $b_prob = "(1/$b_prob)"; }
if ($regcount) { $r_prob = &point(($g/$regcount),3); $r_prob = "(1/$r_prob)"; }

$high_rel_p    = &point(($high_play_count/$high_rel),3) if $high_rel;
$wch_p         = &point(($n_play_count/$wch_count),3) if $wch_count;
$sch_p         = &point(($n_play_count/$sch_count),3) if $sch_count;
$bell_p        = &point(($g/$bell_count),3) if $bell_count;
$big_haz_p     = &point(($big_play/$big_haz_count),3) if $big_haz_count;
$big_suika_p   = &point(($big_play/$big_suika_count),3) if $big_suika_count;
$m1_ch_p       = &point(($m1_ch_count/$wch_m1_count*100),3) if $big_suika_count;


for (@bigget) { $bigget2 += $_; }
$bigget_ave = &point($bigget2/$bigcount,3) if $bigcount;

# 整理したデータ、再試行ボタン、フッタの表示
print <<"__ RESULT __";
</table><br><br>

<table border=1 align='center' cellspacing=0>
<tr align='center' bgcolor='#ffffcc'><td colspan=2><b>秘宝伝 設定 $s_d</b></td></tr>
<tr><td>総プレイ数</td><td align='right'>$g P</td></tr>
<tr><td><b>BIG</b></td><td align='right'><b><font color='red'>$bigcount $b_prob</font></td></tr>
<tr><td><b>REG</b></td><td align='right'><b><font color='red'>$regcount $r_prob</font></td></tr>
<tr><td colspan=2> </td></tr>
<tr><td><font size=2><b>BIG平均獲得枚数</b></font></td><td align='right'><b>$bigget_ave 枚</b></font></td></tr>
<tr><td><font size=2><b>高確率回数(プレイ数)</b></font></td><td align='right'><b>$high_count 回 ( $high_play_count P)</b></font></td></tr>
<tr><td><font size=2><b>高確率の解除回数<br>(高確率での解除確率)</b></font></td><td align='right'><b>$high_rel 回 ( 1/$high_rel_p )</b></font></td></tr>
<tr><td><font size=2><b>弱チャンス目回数</b></font></td><td align='right'><b>$wch_count 回 <font color='red'>( 1/$wch_p )</font></b></td></tr>
<tr><td><font size=2><b>強チャンス目回数</b></font></td><td align='right'><b>$sch_count 回 <font color='red'>( 1/$sch_p )</font></b></td></tr>
<tr><td><font size=2><b>mode 1 滞在時 弱チャンス目<br>での高確当選率</b></font></td><td align='right'><b>$m1_ch_p %</font></b></td></tr>
<tr><td><font size=2>BIG中プレイ数</font></td><td align='right'><b>$big_play P</b></td></tr>
<tr><td><font size=2><b>BIG中スイカ回数(確率)</b></font></td><td align='right'><b>$big_suika_count 回 ( 1/$big_suika_p )</b></td></tr>
<tr><td><font size=2><b>BIG中ハズレ回数(確率)</b></font></td><td align='right'><b>$big_haz_count 回 ( 1/$big_haz_p )</b></td></tr>
<tr><td><font size=2>通常時ベル回数(確率)</font></td><td align='right'><b>$bell_count 回 ( 1/$bell_p )</b></td></tr>
<tr><td colspan=2> </td></tr>
<tr><td>投資</td><td align='right'>$toushi 円</td></tr>
<tr><td>獲得枚数</td><td align='right'><b>$coin 枚</td></tr>
<tr><td>換金</td><td align='right'>$kankin 円</td></tr>
<tr><td>収支</td><td align='right'><font color='$opt3'><b>$shushi 円</b></font></td></tr>
<tr><td>PAYOUT</td><td align='right'><b>$payout %</b></td></tr>
</table>

<br><br><table border=0 align='center' cellspacing=5>
<tr valign='bottom'><td>
<form action='$cginame' method='POST'>
<input type='hidden' name='s' value='$s'>
<input type='hidden' name='play' value='$play'>
<input type='hidden' name='mode' value='$def_mode'>
<input type='hidden' name='s_big' value='$def_sbig'>
<input type='hidden' name='s_reg' value='$def_sreg'>
<input type='hidden' name='hazushi' value='$hazushi'>
<input type='submit' value="再試行">
</form></td><td>

<form action='$cginame' method='POST'>
<input type='hidden' name='s' value='$s'>
<input type='hidden' name='play' value='$play'>
<input type='hidden' name='mode' value='$mode'>
<input type='hidden' name='s_big' value='$s_big'>
<input type='hidden' name='s_reg' value='$s_reg'>
<input type='hidden' name='hazushi' value='$hazushi'>
<input type='hidden' name='ten' value='$ten'>
<input type='submit' value="再試行2(据え置き)">
</form></td><td>

<form action='$cginame' method='POST'>
設定<input type='text' name='s' size=3 value='$s'><br>
<input type='hidden' name='play' value='$play'>
<input type='hidden' name='mode' value='1'>
<input type='hidden' name='s_big' value='$s_big'>
<input type='hidden' name='s_reg' value='$s_reg'>
<input type='hidden' name='hazushi' value='$hazushi'>
<input type='submit' value="再試行3(設定変更)">
</form></td></tr></table>

<br><br><br><br>
<div align='right'>[ <a href='../simu_data_hihou.html'>data</a> / <a href='hihou_memo.html'>memo</a> / <a href='hihou.html'>source</a> ]</div>
<strong>[ <a href='../index.html'>home</a> / <a href='index.html'>cgi</a> / <a href='../jug/index.html'>juggler</a> / <a href='../column.html'>column</a> / <a href='../diary/index.html'>diary</a> / <a href='bbs.cgi'>bbs</a> / <a href='../link.html'>link</a> / <a href='../intro.html'>welcome</a> ]</strong>
</body></html>
__ RESULT __


exit;

# モード移行
sub mode_trans {
    my($mode,$r,$i,$x,@tbl);
    ($mode, @tbl) = @_;

    $r = int(rand(256)+1); $i=0; $x=$tbl[0];
    while ($r > $x) { $i++; $x += $tbl[$i]; }
    return $i;
}

# 高確潜伏プレイ数決定(通常出目B時)
sub wait_high_play_b {
    my($r,$x);
    $r = int(rand(256)+1);
    if ($r <= 64)     { $x =  0; }
    elsif ($r <= 160) { $x =  4; }
    elsif ($r <= 240) { $x =  6; }
    else              { $x = 32; }
    return $x;
}

# 高確潜伏プレイ数決定(チャンス目時)
sub wait_high_play_c {
    my($r,$x);
    $r = int(rand(256)+1);
    if ($r <= 32)     { $x = 0; }
    elsif ($r <= 96)  { $x = 3; }
    elsif ($r <= 160) { $x = 4; }
    else              { $x = 8; }
    return $x;
}

# チャンス目からのボーナス放出時、潜伏プレイ数決定
sub wait_bonus_rel {
    my($r,$x);
    $r = int(rand(256)+1);
    if ($r <= 32)    { $x = 0; }
    elsif ($r <= 48) { $x = 3; }
    elsif ($r <= 80) { $x = 4; }
    else             { $x = 8; }
    return $x;
}

# 少数を四捨五入して指定の桁にする
sub point {
    my($value, $fig, $x);
    ($value, $fig) = @_;

    $value = int($value * (10 ** $fig) + 0.5) / (10 ** $fig);
    if ($value =~ /(\d+)\.(\d+)/) { $x = $2; }
    elsif ($value !~ /\./ && $fig !=0) { $x =''; $value .= '.'; }
    $value = $value.'0' x ( $fig - length($x) );
    return $value;
}


[ home / cgi / juggler / column / diary / bbs / link / welcome ]