1) { $outpt=explode('', $outpt)[-1 + sizeof(explode('>', $outpt))]; if (substr($ops, 0, 1) == 'w') { $newpt=str_replace(' data-piece="' . $ops . '"', ' data-piece="' . explode('_', $mappingsa[$ijh])[0] . '"', $newpt); $newpt=str_replace('>' . $oih, '>♕', $newpt); } else if (substr($ops, 0, 1) == 'b') { $newpt=str_replace(' data-piece="' . $ops . '"', ' data-piece="' . explode('_', $mappingsa[$ijh])[0] . '"', $newpt); $newpt=str_replace('>' . $oih, '>♛', $newpt); } } else if (strpos($outpt, ' data-piece=') !== false) { $ops=explode('>', explode(' ', explode(' data-piece=', $outpt)[1])[0])[0]; $oih=explode('>', $outpt)[-1 + sizeof(explode('>', $outpt))]; if (substr($ops, 0, 1) == 'w') { $newpt=str_replace(' data-piece=' . $ops . ' ', ' data-piece=' . explode('_', $mappingsa[$ijh])[0] . ' ', $newpt); $newpt=str_replace('>' . $oih, '>♕', $newpt); } else if (substr($ops, 0, 1) == 'b') { $newpt=str_replace(' data-piece=' . $ops . ' ', ' data-piece=' . explode('_', $mappingsa[$ijh])[0] . ' ', $newpt); $newpt=str_replace('>' . $oih, '>♛', $newpt); } } else if (strpos($outpt, ' data-answer="') !== false) { $ops=explode('"', explode(' data-answer="', $outpt)[1])[0]; //$oih=explode('>', $outpt)[-1 + sizeof(explode('>', $outpt))]; if (substr($mappingsa[$ijh], 0, 1) == 'w') { $newpt=str_replace(' data-answer="' . $ops . '"', ' data-answer="' . explode('_', $mappingsa[$ijh])[0] . '-9813"', $newpt); //$newpt=str_replace('>' . $oih, '>♗', $newpt); } else if (substr($mappingsa[$ijh], 0, 1) == 'b') { $newpt=str_replace(' data-answer="' . $ops . '"', ' data-answer="' . explode('_', $mappingsa[$ijh])[0] . '-9819"', $newpt); //$newpt=str_replace('>' . $oih, '>♝', $newpt); } } if ($newpt != $outpt) { $outapu=str_replace($outpt, $newpt, $outapu); } } } return $outapu; } function apu($inapu, $sqn) { global $mappingsa, $workwith, $mwith; if ($sqn == '') { $sqn=explode('w', explode('b', explode($inapu . '_', ($workwith . $mwith))[1])[0])[0]; } if (strtoupper(substr($inapu,-1,1)) == (substr($inapu,-1,1)) && strtolower(substr($inapu,-1,1)) != (substr($inapu,-1,1))) { array_push($mappingsa, $inapu . '_' . $sqn); } return $inapu; } function initialgame($intg) { return $intg; $outtg=$intg; $ths=[]; $thas=explode($intg, ''); for ($i=0; $i'; } else { $thisth=''; } array_push($ths, $thisth); $outtg=str_replace($thisth, '', $outtg); } $thas=explode($outtg, ''); for ($i=(-1 + sizeof($ths)); $i>=0; $i--) { $outtg=str_replace($thas[$i], $thas[$i] . $ths[$i], $outtg); } return $outtg; } $across=8; $theans=rand(1,64); $theclue="switch ($nclue) { case 0: $clue = '♜'; break; case 1: $clue = '♜'; break; case 2: $clue = '♜'; break; case 3: $clue = '♜'; break; case 4: $clue = '♜'; break; case 5: $clue = '♜'; break; case 6: $clue = '♜'; break; case 7: $clue = '♜'; break; case 8: $clue = '♜'; break; case 9: $clue = '♜'; break; case 10: $clue = '♜'; break; case 11: $clue = '♜'; break; case 12: $clue = '♜'; break; case 13: $clue = '♜'; break; case 14: $clue = '♜'; break; case 15: $clue = '♜'; break; case 16: $clue = '♜'; break; case 17: $clue = '♜'; break; case 18: $clue = '♜'; break; case 19: $clue = '♜'; break; case 20: $clue = '♜'; break; case 21: $clue = '♜'; break; case 22: $clue = '♜'; break; case 23: $clue = '♜'; break; case 24: $clue = '♜'; break; case 25: $clue = '♜'; break; case 26: $clue = '♜'; break; case 27: $clue = '♜'; break; case 28: $clue = '♜'; break; case 29: $clue = '♜'; break; case 30: $clue = '♜'; break; case 31: $clue = '♜'; break; case 32: $clue = '♜'; break; case 33: $clue = '♜'; break; case 34: $clue = '♜'; break; case 35: $clue = '♜'; break; case 36: $clue = '♜'; break; case 37: $clue = '♜'; break; case 38: $clue = '♜'; break; case 39: $clue = '♜'; break; case 40: $clue = '♜'; break; case 41: $clue = '♜'; break; case 42: $clue = '♜'; break; case 43: $clue = '♜'; break; case 44: $clue = '♜'; break; case 45: $clue = '♜'; break; case 46: $clue = '♜'; break; case 47: $clue = '♜'; break; case 48: $clue = '♜'; break; case 49: $clue = '♜'; break; case 50: $clue = '♜'; break; case 51: $clue = '♜'; break; case 52: $clue = '♜'; break; case 53: $clue = '♜'; break; case 54: $clue = '♜'; break; case 55: $clue = '♜'; break; case 56: $clue = '♜'; break; case 57: $clue = '♜'; break; case 58: $clue = '♜'; break; case 59: $clue = '♜'; break; case 60: $clue = '♜'; break; case 61: $clue = '♜'; break; case 62: $clue = '♜'; break; case 63: $clue = '♜'; break; case 64: $clue = '♜'; break; } "; //$theclue=file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/Games/Battleshipsandcruisers/index2.php'); $ansa=explode('case ' . $theans . ':', $theclue); $thecluewording=explode("'", explode("'", $ansa[1])[1])[0]; $scorebit=''; if (isset($_GET['score']) && isset($_GET['secs'])) { $scorebit="Score " . $_GET['score'] . '/' . $_GET['secs']; } $wikistuff=str_replace(' ','_',$thecluewording) . ' ' . $thecluewording; $wikistuff="1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63 64 64 "; $lastotherde=''; $wikistuffs=explode("\n", $wikistuff); $wikidesignations=[]; $wikidescriptions=[]; $crandlist=''; $randlist=[]; for ($i=0; $i= 3) { if (strpos($workwith, $suffs[0] . '_' . $suffs[1]) === false) { $mwith=$suffs[0] . '_' . $suffs[1]; } else { $mwith=''; } } } $ps=explode('_', ($workwith . $mwith)); $finnards=$drux . '?traditional='; if (sizeof($ps) == 1) { if ($workwith == 'mayhem') { $finnards.='mayhem'; if (isset($_GET['bname'])) { $finnards.='&bname=' . $_GET['bname']; if (!isset($_GET['wname'])) { $finnards.='&wname='; } } if (isset($_GET['wname'])) { if (!isset($_GET['bname'])) { $finnards.='&bname='; } $finnards.='&wname=' . $_GET['wname']; } $suffards='&move='; } else { if ($workwith == 'draughts' || isset($_GET['draughts'])) { if (isset($_GET['draughts'])) { $suffards='&draughts='; } //if ($workwith == 'draughts') { $cpa=['bB1','wB1','bB2','wB2','bB3','wB3','bB4','wB4','bB5','wB5','bB6','wB6','bB7','wB7','bB8','wB8','bB9','wB9','bBv','wBv','bBu','wBu','bBt','wBt']; $staidmap=[1,56,3,58,5,60,7,62,8,49,10,51,12,53,14,55,17,40,19,42,21,44,23,46]; //} } else { $cpa=['bK','wK','bQ','wQ','bR1','wR1','bR2','wR2','bB1','wB1','bB2','wB2','bK1','wK1','bK2','wK2','bP1','wP1','bP2','wP2','bP3','wP3','bP4','wP4','bP5','wP5','bP6','wP6','bP7','wP7','bP8','wP8']; $staidmap=[4,60,3,59,0,56,7,63, 2,58,5,61, 1,57,6,62, 8,48,9,49,10,50,11,51,12,52,13,53,14,54,15,55]; } for ($ips=0; $ips' . $ijk . ''; } else if (($ijk % 3) == 0) { $arow=str_replace('', '' . $ijk . '', $arow); $templategame=str_replace('', $arow . '', $templategame); $arow=''; } else { $arow=str_replace('', '' . $ijk . '', $arow); } } $templategame=str_replace('', $arow . '', $templategame); //file_put_contents('xx.html', $templategame); $curclass='white'; if ($across != 3 && 1 == 1) { $irws=1; $usedtobesofartd=''; $sofartd=''; $two=2; $wasih="", explode(""; $origih=$wasih; $rowas=explode("", $wasih); for ($irws=1; $irws 3 && strpos(substr(str_replace("\n","",$rowas[$irws]),0,2),'', $rowas[(-1 + $irws)] . '', $wasih); } } $rowas=explode(" 3) { $wasih=str_replace('', $rowas[$irws])[0] . '>', '-' . '->', $rowas[$irws]), $wasih); } } //file_put_contents('xxxx.html', str_replace($origih, $wasih, $templategame)); $usedtoberowas=explode("", $wasih); $rowas=explode("", $wasih); for ($irws=0; $irws') === false) { $rowas[$irws]=str_replace('', $rowas[$irws])[-1 + sizeof(explode('>', $rowas[$irws]))]; //$rowas[$irws]=str_replace($fb, $fb . ' data-square=' . (1 + $irws) . '', $rowas[$irws]); //} if ($curclass == 'white' && strpos($rowas[$irws], '') === false) { $curclass='white'; } else { $curclass='black'; } if (((1 + $irws) % $across) == 0) { $usedtobesofartd.=$usedtoberowas[$irws] . ''; $sofartd.=$rowas[$irws] . ''; $wasih=str_replace($usedtobesofartd, $sofartd . '', $wasih); $usedtobesofartd=''; $sofartd=''; $two++; } else { $usedtobesofartd.=$usedtoberowas[$irws] . ''; $sofartd.=$rowas[$irws] . ''; } } for ($irws=9; $irws<=16; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=1; $irws<=8; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" style="background-color: rgba(255,255,255,0.6);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=25; $irws<=32; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=17; $irws<=24; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=41; $irws<=48; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=33; $irws<=40; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=57; $irws<=64; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . (1 + $irws) . ' ', $wasih); } for ($irws=49; $irws<=56; $irws+=2) { $wasih=str_replace(' data-square=' . $irws . ' ', ' class=white style="background-color: rgba(255,255,255,0.5);" data-square=' . $irws . ' ', $wasih); $wasih=str_replace(' data-square=' . (1 + $irws) . ' ', ' class=black style="background-color: rgba(0,0,0,0.6);" data-square=' . (1 + $irws) . ' ', $wasih); } //file_put_contents('x.html', str_replace($origih, $wasih, $templategame)); $templategame=str_replace($origih, $wasih, $templategame); } } //file_put_contents('xxx.html', $templategame); $namesdecided=''; $templategame=str_replace(' contenteditable=', ' data-contenteditable=', $templategame); $templategame=str_replace('', '', $templategame); if (!isset($_GET['traditional'])) { $templategame=str_replace('', ' 
', $templategame); } else if (strpos($_GET['traditional'], 'mayhem') !== false) { $templategame=str_replace('', ' 
', $templategame); } else if (isset($_GET['bname']) && isset($_GET['wname'])) { $namesdecided=' data-decided="bw" '; $templategame=str_replace('', ' 

' . str_replace('+',' ',urldecode($_GET['bname'])) . '

 versus 

' . str_replace('+',' ',urldecode($_GET['wname'])) . '

', $templategame); } else if (isset($_GET['wname'])) { $namesdecided=' data-decided="w" '; $templategame=str_replace('', ' 

Black

 versus 

' . str_replace('+',' ',urldecode($_GET['wname'])) . '

', $templategame); } else if (isset($_GET['bname'])) { $namesdecided=' data-decided="b" '; $templategame=str_replace('', ' 

' . str_replace('+',' ',urldecode($_GET['bname'])) . '

 versus 

White

', $templategame); } else { $templategame=str_replace('', ' 

Black

 versus 

White

', $templategame); } if ($workwith == 'draughts' || isset($_GET['draughts'])) { $templategame=str_replace('>Game', ' style=background-color:orange;>Draughts Game
Practice 

', $templategame); } else { $templategame=str_replace('>Game', ' style=background-color:lime;>Chess Game
Practice 

', $templategame); } $templategame=str_replace('>', '>' . $scorebit . '', $templategame); $thepsource=explode('f0;">', explode("

", $templategame)[0])[-1 + sizeof(explode('f0;">', explode("

", $templategame)[0]))]; //$templategame=str_replace(', 2023<', ', 2023 ... thanks to https://en.wikipedia.org/wiki/Street_suffix<', $templategame); $templategame=str_replace('>Reset example<', ' style="display:none;">Reset example<', $templategame); if (1 == 2) { $templategame=str_replace('', "", $templategame); } else { if ($workwith == 'draughts' || isset($_GET['draughts'])) { $templategame=str_replace('', "", $templategame)); } else { $templategame=str_replace('', "", $templategame)); } $dzfrom='Drop Zone'; $dzto=''; if (!isset($_GET['traditional'])) { $templategame=str_replace($dzfrom, $dzto, $templategame); $dzfrom='Experimental Drag and Drop'; //$dzto=$dzfrom . '   ... no checks on move lagaility yet ...'; $dzto=str_replace(' and ',' & ',$dzfrom) . '     '; } else { $templategame=str_replace("https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData","",$templategame); $templategame=str_replace("Thanks to ","",$templategame); $templategame=str_replace($dzfrom, $dzto, $templategame); $dzfrom='Experimental Drag and Drop'; $dzto=str_replace(' and ',' & ',$dzfrom) . ''; } if ($workwith == 'draughts' || isset($_GET['draughts'])) { $templategame=str_replace($dzfrom, $dzto, str_replace(') : 3;', ') : 8; // 8', str_replace(') : 9;', ') : 64; // 64', str_replace(')) : 1;', ')) : 0; // 32', str_replace('] ? true : false;', '] ? true : false; ', str_replace(") : '';", ") : '♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗ ♝ ♗';", $templategame)))))); } else { $templategame=str_replace($dzfrom, $dzto, str_replace(') : 3;', ') : 8; // 8', str_replace(') : 9;', ') : 64; // 64', str_replace(')) : 1;', ')) : 0; // 32', str_replace('] ? true : false;', '] ? true : false; ', str_replace(") : '';", ") : '♚ ♔ ♛ ♕ ♜ ♜ ♖ ♝ ♝ ♗ ♞ ♘ ♘ ♟ ♙ ♟ ♙⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠';", $templategame)))))); } } //echo $crandlist . "\n" . $thepsource . "\n" . $correctans . "\n"; //exit; //echo $crandlist . "\n"; //echo "" . $randlist[$correctans] . "\n" . $wikidescriptions[$randlist[$correctans]] . "\n" . $wikidesignations[$randlist[$correctans]]; //exit; $templategame=str_replace("", "", $templategame); if ($randmode == 0) { // designation up top and descriptions in drop zone $templategame=str_replace('>' . (1 + $correctans) . '<', ' style=text-align:center; data-answer="0' . $theans . '">' . $theans . '<', $templategame); $templategame=str_replace('">' . $thepsource . '<', 'text-align:center;" data-answer="0' . $theans. '">' . $thecluewording . '<', $templategame); for ($i=1; $i<=99; $i++) { if ((-1 + $i) != $correctans) { $templategame=str_replace('>' . $i . '
' . $i . '' . (1 + $correctans) . '<', ' style=text-align:center; data-answer="' . $wikidesignations[$randlist[$correctans]] . '">' .$wikidesignations[$randlist[$correctans]] . '<', $templategame); $templategame=str_replace('">' . $thepsource . '<', 'text-align:center;" data-answer="' . $wikidesignations[$randlist[$correctans]] . '">' . $wikidescriptions[$randlist[$correctans]] . '<', $templategame); for ($i=1; $i<=99; $i++) { if ((-1 + $i) != $correctans) { $templategame=str_replace('>' . $i . '' . mapittwo($wikidesignations[$randlist[-1 + $i]]) . '