#! /usr/local/bin/perl require 'jcode.pl'; @{$t{'月齢'}} = ("新月", "三日月", "七日月", "上弦の月", "十日夜", "十三夜", "満月", "十六夜", "居待月", "下弦の月", "二十日余月", "二十六夜"); @{$t{'曜日'}} = ("火", "土", "水", "風", "氷", "雷", "光", "闇"); @{$t{'装備'}} = ('A1', 'A2', 'A3', 'B1', 'B2', 'B3'); @{$t{'CHR'}} = (94, 100, 93, 75, 81, 74); ($year, $mon, $day, $hour, $min, $sec) = (localtime)[5,4,3,2,1,0]; $year += 1900; $mon++; $now = sprintf("%04d/%02d/%02d %02d:%02d:%02d", $year, $mon, $day, $hour, $min, $sec); open(IN, 'R_result.txt'); while () { chomp; $line = $_; &jcode'convert(*line, 'euc', 'sjis'); if ($line =~ /\*\*\*\*\* (\S+) \*\*\*\*\*$/) { $phase = $1; } elsif ($line =~ /■ あやつり対象: (.+)$/) { $pet = $1; } elsif ($line =~ /\[([^]]+)\]/) { $mode = $1; if ($line =~ /\(([^)]+)\)/) { $sub = $1; } else { $sub = ''; } } if ($mode eq '連続あやつりミス回数') { if ($line =~ /^(.+): (\d+)$/) { $miss{$phase}{$pet}{$1} = $2; } } if ($mode =~ /操り成功率/) { if ($line =~ /^(.+)-(.+): (.+); p=(.+)$/) { $dat{$phase}{$pet}{$mode}{$sub}{'比率差'}{$1}{$2}{'有意差'} = $3; $dat{$phase}{$pet}{$mode}{$sub}{'比率差'}{$1}{$2}{'p-value'} = $4; } elsif ($line =~ /^(.+): (\S+) \(([^)]+)\)$/) { $dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$1}{'成功率'} = $2; $dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$1}{'95%信頼区間'} = $3; } } } close (IN); open(IN, 'index-src.html'); open(OUT, '> index.html'); while () { chomp; $line = $_; &jcode'convert(*line, 'euc', 'sjis'); if ($line =~ /### (.+) ###/) { $keys = $1; @keys = split(/\//, $keys); $phase = $keys[0]; $type = $keys[1]; $style = $keys[2]; $pet = $keys[3]; $mode = $keys[4]; if ($mode =~ /\+/) { ($mode, $option) = split(/\+/, $mode); } else { $option = ''; } if ($mode =~ /^(....)/) { $mode1 = $1; } $sub = ''.$keys[5]; } else { &jcode'convert(*line, 'sjis', 'euc'); print OUT "$line\n"; next; } if ($keys eq '更新日時') { $html = "(更新日時: $now)
"; } elsif ($style eq 'text') { if ($type eq '成功率結果') { $html = ''; for ($i = 0; $i < @{$t{$mode1}}; $i++) { $t = $t{$mode1}[$i]; $html .= <<"HTML"; ${t{$mode1}[$i]}: ${dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$t}{'成功率'}} (${dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$t}{'95%信頼区間'}})
HTML } } elsif ($type eq '有意差') { $html = '';# 仮 } elsif ($type eq '有意差○×') { $html = '';# 仮 } else { $html = '' } } elsif ($style eq 'table') { if ($type eq '成功率結果') { if ($mode1 eq '装備') { $chr_str = 'CHR'; if ($option eq '連続操りミス') { $option_str = '連続操りミス回数'; } else { $option_str = ''; } } else { $chr_str = ''; $option_str = ''; } $html = <<"HTML"; $chr_str$option_str HTML for ($i = 0; $i < @{$t{$mode1}}; $i++) { $t = $t{$mode1}[$i]; if ($mode1 eq '装備') { $chr_str = ""; if ($option eq '連続操りミス') { $option_str = ""; } else { $option_str = ''; } } else { $chr_str = ''; $option_str = ''; } $success = ${dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$t}{'成功率'}}; $conf_int = ${dat{$phase}{$pet}{$mode}{$sub}{'成功率'}{$t}{'95%信頼区間'}}; if ($success eq '0/0=0%') { $success = '
'; $conf_int = '
'; } $html .= <<"HTML"; $chr_str$option_str HTML } $html .= <<"HTML";
$mode1操り成功率95%信頼区間
${$t{'CHR'}}[$i]${miss{$phase}{$pet}{$t}}
${t{$mode1}[$i]}$success$conf_int
HTML } elsif ($type eq '有意差') { $html = <<"HTML"; HTML for ($i = 0; $i < @{$t{$mode1}} - 1; $i++) { $t1 = $t{$mode1}[$i]; for ($j = $i + 1; $j < @{$t{$mode1}}; $j++) { $t2 = $t{$mode1}[$j]; $p = $dat{$phase}{$pet}{$mode}{$sub}{'比率差'}{$t1}{$t2}{'p-value'}; $html .= <<"HTML"; HTML } } $html .= <<"HTML";
比較する条件p-value
$t1-$t2$p
HTML } elsif ($type eq '有意差○×') { $html = <<"HTML"; HTML for ($i = 1; $i < @{$t{$mode1}}; $i++) { $t1 = $t{$mode1}[$i]; $html .= <<"HTML"; HTML for ($j = 0; $j < $i; $j++) { $t2 = $t{$mode1}[$j]; $ox = $dat{$phase}{$pet}{$mode}{$sub}{'比率差'}{$t2}{$t1}{'有意差'}; $html .= <<"HTML"; HTML } $html .= <<"HTML"; HTML } $html .= <<"HTML"; HTML for ($j = 0; $j < @{$t{$mode1}} - 1; $j++) { $t2 = $t{$mode1}[$j]; $html .= <<"HTML"; HTML } $html .= <<"HTML";
$t1$ox
$t2
HTML } else { $html = '' } } &jcode'convert(*html, 'sjis', 'euc'); print OUT "$html\n"; } close(OUT); close(IN);