jug7.com
[ home / cgi / juggler / column / diary / bbs / link / welcome ]
source : ハイサイ潮姫
#!/usr/bin/perl
# はいさい潮姫 シミュレーション
$cginame = 'shiohime.cgi';
$title = 'ハイサイ潮姫 シミュレーション';
$url_data = '../simu_data_shiohime.html';
$url_memo = 'shiohime_memo.html';
$url_source = 'shiohime.html';
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read (STDIN, $input, $ENV{'CONTENT_LENGTH'});
}
foreach $str (split(/&/,$input)) {
($name,$value) = split(/=/, $str);
push(@input, $value);
}
($s, $play) = @input; # 設定, プレイ数
print "Content-Type: text/html\n\n";
$s = 1 if !$s;
$s = 2 if $s==6; # 設定6はシミュ内では 2
$check[$s] = 'checked';
# ヘッダとフォームの表示
print <<"__ HTML __";
<!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='$url_data'>data</a> / <a href='$url_memo'>memo</a> / <a href='$url_source'>source</a> ]</div>
<br><br><center>
<form action='$cginame' method='POST'>
<table border=0>
<tr><td>設定</td><td><input type='radio' name='s' value='1' $check[1]> 設定 1<input type='radio' name='s' value='2' $check[2]> 設定 6</td></tr>
<tr><td>試行ゲーム数</td><td><input type='text' size=10 name='play' maxlength=4 value='$play'></td></tr>
</table><br>
<input type='submit' value="開始">
<br><br>
<table border=0><tr><td>
</td></tr></table>
</form></center>
__ HTML __
# エラーチェックと GET 送信
if ($play > 9999) { $error = 1; $er_msg = 'プレイ数は最大9999Pまでです。'; }
if (!$play or !$s) { $error = 1; $er_msg = '記入漏れがあります。'; }
if ($s!=1 && $s!=2) { $error = 1; $er_msg = '設定は 1 or 6 です。'; }
if (grep { /[^\d\.]/ } @input) { $error = 1; $er_msg = '不適切な文字が記入されています。'; };
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 "<div align='right'>[ <a href='$url_data'>data</a> / <a href='$url_memo'>memo</a> / <a href='$url_source'>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;
}
# data /65536
@big_7 = (120,137); $big_7 = $big_7[$s-1];
@big_shio = (120,137); $big_shio = $big_shio[$s-1];
@che_red = (128,136); $che_red = $che_red[$s-1];
@che_blue = (128,136); $che_blue = $che_blue[$s-1];
@hib = (40,48); $hib = $hib[$s-1];
@bell = (8200,8250); $bell = $bell[$s-1];
$rep = 8980;
$ko1_7bb = 2;
$ko1_bbb = 2;
print q{<table border=1 cellspacing=0 align='center' cellpadding=2><caption>シミュレーション結果</caption>},"\n";
print q{<tr align='center' bgcolor='#ffffcc'><td><font size=2>ゲーム数</font></td><td><font size=2>当選</font></td>};
print q{<td>備考</td><td><font size=2>BIG<br>回数</font></td><td><font size=2>投資</font></td>};
print q{<td><font size=2>コイン</font></td><td><font size=2>total<br>ゲーム数</font></td></tr>},"\n";
#---------------------------
# シミュレート開始
#---------------------------
$g = $count = $coin = $k = $totalk = 0;
$red_big_count = $blue_big_count = $reg_count = 0;
$flag = $big_7_flag = $big_shio_flag = $che_count = 0;
$msg = ' '; $tbl_clr = '';
while (1) {
$g++; $count++;
if ($coin < 3) { $coin += 50; $k++; $totalk++; }
$coin -= 3;
if ($wait) { $wait--; }
$r = int(rand(65536)+1);
if ($r <= $bell) { $coin += 8; next; }
elsif ($r <= $bell+$rep) { $coin += 3; next; }
elsif ($r <= $bell+$rep+$che_red) {
$coin += 3;
$che_count++;
$r = int(rand(65536)+1);
if ($r <= 32768) { $flag = $big_7_flag = 1; $msg = '<font size=2 color=\'red\'>赤チェリー 同時抽選</font>'; $wait = 1; $che_hit++; }
} elsif ($r <= $bell+$rep+$che_red+$che_blue) {
$coin += 3;
$che_count++;
$r = int(rand(65536)+1);
if ($r <= 32768) { $flag = $big_shio_flag = 1; $msg = '<font size=2 color=\'blue\'>青チェリー 同時抽選</font>'; $wait = 1; $che_hit++; }
} elsif ($r <= $bell+$rep+$che_red+$che_blue+$big_7) { $flag = $big_7_flag = 1; $wait = 0; }
elsif ($r <= $bell+$rep+$che_red+$che_blue+$big_7+$big_shio) { $flag = $big_shio_flag = 1; $wait = 1; }
elsif ($r <= $bell+$rep+$che_red+$che_blue+$big_7+$big_shio+$hib) {
$msg = '<b><font size=2>ハイビスカス 同時抽選</font></b>';
$coin += 1;
$r = int(rand(65536)+1);
if ($r <= 32768) { $flag = $big_7_flag = 1; $wait = 0; }
else { $flag = $big_shio_flag = 1; $wait = 1; }
} elsif ($r <= $bell+$rep+$che_red+$che_blue+$big_7+$big_shio+$hib+$ko1_7bb) {
$msg = '<b><font size=2 color=\'red\'>7 ベル ベル 同時抽選</font></b>';
$coin += 1;
$r = int(rand(65536)+1);
if ($r <= 32768) { $flag = $big_7_flag = 1; $wait = 0; }
else { $flag = $big_shio_flag = 1; $wait = 1; }
} elsif ($r <= $bell+$rep+$che_red+$che_blue+$big_7+$big_shio+$hib+$ko1_7bb+$ko1_bbb) {
$msg = '<b><font size=2 color=\'blue\'>SHIO ベル ベル 同時抽選</font></b>';
$coin += 1;
$r = int(rand(65536)+1);
if ($r <= 32768) { $flag = $big_7_flag = 1; $wait = 0; }
else { $flag = $big_shio_flag = 1; $wait = 1; }
}
if ($flag && $wait<=0) {
$k = ($k > 0) ? $k .'k' : ' ';
if ($big_7_flag) { $get = '<font color=\'red\' face=\'Arial black\'><strong>777</strong></font>'; $tbl_clr =''; $coin += 238; $big_7_count++; }
elsif ($big_shio_flag) { $get = '<font color=\'ffff00\' face=\'Times New Roman\'><strong><font size=2>SHIOHIME</font></strong></font>'; $tbl_clr='bgcolor=\'0000aa\''; $coin += 238; $big_shio_count++; }
$opt = ($count < 100) ? "<b><font color='blue'>" : ($count >= 500) ? "<b><font color='red'>" : '';
$opt2 = ($count < 100) ? "</font></b>" : ($count >= 500) ? "</font></b>" : '';
$big_count = $big_7_count + $big_shio_count;
if ($big_count) { $b_prob = int($g/$big_count+0.5); $b_prob = "(1/$b_prob)"; }
print "<tr align='center'><td align='right'>$opt $count $opt2</td><td $tbl_clr>$get</td><td>$msg</td>";
print "<td><font color='blue'>$big_count</font> $b_prob</td>";
print "<td>$k</td><td>$coin</td><td>$g</td></tr>\n";
$flag = $big_7_flag = $big_shio_flag = $wait = $count = 0;
$k=''; $msg = ' '; $tbl_clr ='';
}
if ($g >= $play) {
$k = ($k > 0) ? $k.'k' : ' ';
if ($big_count) { $b_prob = int($g/$big_count+0.5); $b_prob = "(1/$b_prob)"; }
print "<tr align='center'><td align='right'>$count</td></td><td>ヤメ</td>";
print "<td> </td><td><font color='blue'>$big_count</font> $b_prob</td>";
print "<td>$k</td><td>$coin</td><td>$g</td></tr>\n";
last;
}
}
print '</table><br><br><br>';
# 結果の整理
$toushi = $totalk * 1000;
$kankin = int($coin*20);
$shushi = $kankin - $toushi;
$opt3 = ($shushi >= 0) ? 'blue' : 'red';
$payout = ($coin-($totalk*50))/($g*3)*100+100;
$payout = &point($payout,3);
if ($big_count) { $b_prob = &point(($g/$big_count),3); $b_prob = "(1/$b_prob)"; }
if ($big_7_count) { $big_7_prob = &point(($g/$big_7_count),3); $big_7_prob = "(1/$big_7_prob)"; }
if ($big_shio_count) { $big_shio_prob = &point(($g/$big_shio_count),3); $big_shio_prob = "(1/$big_shio_prob)"; }
if ($che_hit) { $che_hit_per = &point(($che_hit/$che_count *100),3); }
$t_bigget = $big_count*238;
$coin1k = &point(($g*50/($t_bigget + $totalk*50 - $coin)), 3);
$s_d = $s;
$s_d = 6 if $s_d==2;
# 整理した結果と再試行ボタン、フッタの表示
print <<"__ HTML __";
<table border=1 align='center' cellpadding=3 cellspacing=0>
<tr align='center' bgcolor='#ffffcc'><td colspan=2><b>ハイサイ潮姫</b> <b>設定 $s_d</font></td></tr>
<tr><td>プレイ数</td><td align='right'> $g P</td></tr>
<tr><td><b>BIG</b></td><td align='right'><b>$big_count 回 <font color='red'>$b_prob</font></td></tr>
<tr><td align='center'><b><font color='red' face='Arial black'>777</font></b></td><td align='right'><b>$big_7_count 回 <font color='red'>$big_7_prob</font></td></tr>
<tr><td bgcolor='#0000aa' align='center'><b><font color='#ffff00' face='Times New Roman'>SHIOHIME</font></b></td><td align='right'><b>$big_shio_count 回 <font color='red'>$big_shio_prob</font></td></tr>
<tr><td><b><font size=2>チェリーからの当選</font></b></td><td align='right'><b>$che_hit 回 <font color='red'>( $che_hit_per % )</font></td></tr>
<tr><td>投資</td><td align='right'>$toushi 円</td></tr>
<tr><td>獲得</td><td align='right'>$coin 枚</td></tr>
<tr><td>換金</td><td align='right'>$kankin 円</td></tr>
<tr><td>PAYOUT</td><td align='right'><b>$payout %</b></td></tr>
<tr><td>1k当たり</td><td align='right'><b>$coin1k P</b></td></tr>
<tr><td>収支</td><td align='right'><font color='$opt3'><b>$shushi 円</b></font></td></tr>
</table></center>
<form action='$cginame' method='POST'>
<input type='hidden' name='s' value='$s'>
<input type='hidden' name='play' value='$play'>
<center><input type='submit' value='再試行'></center>
</form>
<br><br><br><br>
<div align='right'>[ <a href='$url_data'>data</a> / <a href='$url_memo'>memo</a> / <a href='$url_source'>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>
__ HTML __
exit;
# 少数を四捨五入して指定の桁にする
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 !~ /\./) { $x =''; $value .= '.'; }
$value = $value.'0' x ( $fig - length($x) );
return $value;
}
[ home / cgi / juggler / column / diary / bbs / link / welcome ]