if ($user['room'] == 403) { $s = db::c()->query('SELECT * FROM podzem2 WHERE name= "?s"', $mir['name'])->fetch_assoc(); $rooms[0] = ""; // характеристики комнат $rhar = []; $vector = 0; $rhar['01'] = [$s["v1"], $s["p1"], $s["n1"], $s["l1"]]; $rhar['02'] = [$s["v2"], $s["p2"], $s["n2"], $s["l2"]]; $rhar['03'] = [$s["v3"], $s["p3"], $s["n3"], $s["l3"]]; $rhar['04'] = [$s["v4"], $s["p4"], $s["n4"], $s["l4"]]; $rhar['05'] = [$s["v5"], $s["p5"], $s["n5"], $s["l5"]]; $rhar['06'] = [$s["v6"], $s["p6"], $s["n6"], $s["l6"]]; $rhar['07'] = [$s["v7"], $s["p7"], $s["n7"], $s["l7"]]; $rhar['08'] = [$s["v8"], $s["p8"], $s["n8"], $s["l8"]]; $rhar['09'] = [$s["v9"], $s["p9"], $s["n9"], $s["l9"]]; $rhar['11'] = [$s["v11"], $s["p11"], $s["n11"], $s["l11"]]; $rhar['12'] = [$s["v12"], $s["p12"], $s["n12"], $s["l12"]]; $rhar['13'] = [$s["v13"], $s["p13"], $s["n13"], $s["l13"]]; $rhar['14'] = [$s["v14"], $s["p14"], $s["n14"], $s["l14"]]; $rhar['15'] = [$s["v15"], $s["p15"], $s["n15"], $s["l15"]]; $rhar['16'] = [$s["v16"], $s["p16"], $s["n16"], $s["l16"]]; $rhar['17'] = [$s["v17"], $s["p17"], $s["n17"], $s["l17"]]; $rhar['18'] = [$s["v18"], $s["p18"], $s["n18"], $s["l18"]]; $rhar['19'] = [$s["v19"], $s["p19"], $s["n19"], $s["l19"]]; $rhar['21'] = [$s["v21"], $s["p21"], $s["n21"], $s["l21"]]; $rhar['22'] = [$s["v22"], $s["p22"], $s["n22"], $s["l22"]]; $rhar['23'] = [$s["v23"], $s["p23"], $s["n23"], $s["l23"]]; $rhar['24'] = [$s["v24"], $s["p24"], $s["n24"], $s["l24"]]; $rhar['25'] = [$s["v25"], $s["p25"], $s["n25"], $s["l25"]]; $rhar['26'] = [$s["v26"], $s["p26"], $s["n26"], $s["l26"]]; $rhar['27'] = [$s["v27"], $s["p27"], $s["n27"], $s["l27"]]; $rhar['28'] = [$s["v28"], $s["p28"], $s["n28"], $s["l28"]]; $rhar['29'] = [$s["v29"], $s["p29"], $s["n29"], $s["l29"]]; $rhar['31'] = [$s["v31"], $s["p31"], $s["n31"], $s["l31"]]; $rhar['32'] = [$s["v32"], $s["p32"], $s["n32"], $s["l32"]]; $rhar['33'] = [$s["v33"], $s["p33"], $s["n33"], $s["l33"]]; $rhar['34'] = [$s["v34"], $s["p34"], $s["n34"], $s["l34"]]; $rhar['35'] = [$s["v35"], $s["p35"], $s["n35"], $s["l35"]]; $rhar['36'] = [$s["v36"], $s["p36"], $s["n36"], $s["l36"]]; $rhar['37'] = [$s["v37"], $s["p37"], $s["n37"], $s["l37"]]; $rhar['38'] = [$s["v38"], $s["p38"], $s["n38"], $s["l38"]]; $rhar['39'] = [$s["v39"], $s["p39"], $s["n39"], $s["l39"]]; $rhar['41'] = [$s["v41"], $s["p41"], $s["n41"], $s["l41"]]; $rhar['42'] = [$s["v42"], $s["p42"], $s["n42"], $s["l42"]]; $rhar['43'] = [$s["v43"], $s["p43"], $s["n43"], $s["l43"]]; $rhar['44'] = [$s["v44"], $s["p44"], $s["n44"], $s["l44"]]; $rhar['45'] = [$s["v45"], $s["p45"], $s["n45"], $s["l45"]]; $rhar['46'] = [$s["v46"], $s["p46"], $s["n46"], $s["l46"]]; $rhar['47'] = [$s["v47"], $s["p47"], $s["n47"], $s["l47"]]; $rhar['48'] = [$s["v48"], $s["p48"], $s["n48"], $s["l48"]]; $rhar['49'] = [$s["v49"], $s["p49"], $s["n49"], $s["l49"]]; $rhar['51'] = [$s["v51"], $s["p51"], $s["n51"], $s["l51"]]; $rhar['52'] = [$s["v52"], $s["p52"], $s["n52"], $s["l52"]]; $rhar['53'] = [$s["v53"], $s["p53"], $s["n53"], $s["l53"]]; $rhar['54'] = [$s["v54"], $s["p54"], $s["n54"], $s["l54"]]; $rhar['55'] = [$s["v55"], $s["p55"], $s["n55"], $s["l55"]]; $rhar['56'] = [$s["v56"], $s["p56"], $s["n56"], $s["l56"]]; $rhar['57'] = [$s["v57"], $s["p57"], $s["n57"], $s["l57"]]; $rhar['58'] = [$s["v58"], $s["p58"], $s["n58"], $s["l58"]]; $rhar['59'] = [$s["v59"], $s["p59"], $s["n59"], $s["l59"]]; $rhar['61'] = [$s["v61"], $s["p61"], $s["n61"], $s["l61"]]; $rhar['62'] = [$s["v62"], $s["p62"], $s["n62"], $s["l62"]]; $rhar['63'] = [$s["v63"], $s["p63"], $s["n63"], $s["l63"]]; $rhar['64'] = [$s["v64"], $s["p64"], $s["n64"], $s["l64"]]; $rhar['65'] = [$s["v65"], $s["p65"], $s["n65"], $s["l65"]]; $rhar['66'] = [$s["v66"], $s["p66"], $s["n66"], $s["l66"]]; $rhar['67'] = [$s["v67"], $s["p67"], $s["n67"], $s["l67"]]; $rhar['68'] = [$s["v68"], $s["p68"], $s["n68"], $s["l68"]]; $rhar['69'] = [$s["v69"], $s["p69"], $s["n69"], $s["l69"]]; $rhar['71'] = [$s["v71"], $s["p71"], $s["n71"], $s["l71"]]; $rhar['72'] = [$s["v72"], $s["p72"], $s["n72"], $s["l72"]]; $rhar['73'] = [$s["v73"], $s["p73"], $s["n73"], $s["l73"]]; $rhar['74'] = [$s["v74"], $s["p74"], $s["n74"], $s["l74"]]; $rhar['75'] = [$s["v75"], $s["p75"], $s["n75"], $s["l75"]]; $rhar['76'] = [$s["v76"], $s["p76"], $s["n76"], $s["l76"]]; $rhar['77'] = [$s["v77"], $s["p77"], $s["n77"], $s["l77"]]; $rhar['78'] = [$s["v78"], $s["p78"], $s["n78"], $s["l78"]]; $rhar['79'] = [$s["v79"], $s["p79"], $s["n79"], $s["l79"]]; $rhar['81'] = [$s["v81"], $s["p81"], $s["n81"], $s["l81"]]; $rhar['82'] = [$s["v82"], $s["p82"], $s["n82"], $s["l82"]]; $rhar['83'] = [$s["v83"], $s["p83"], $s["n83"], $s["l83"]]; $rhar['84'] = [$s["v84"], $s["p84"], $s["n84"], $s["l84"]]; $rhar['85'] = [$s["v85"], $s["p85"], $s["n85"], $s["l85"]]; $rhar['86'] = [$s["v86"], $s["p86"], $s["n86"], $s["l86"]]; $rhar['87'] = [$s["v87"], $s["p87"], $s["n87"], $s["l87"]]; $rhar['88'] = [$s["v88"], $s["p88"], $s["n88"], $s["l88"]]; $rhar['89'] = [$s["v89"], $s["p89"], $s["n89"], $s["l89"]]; $rhar['91'] = [$s["v91"], $s["p91"], $s["n91"], $s["l91"]]; $rhar['92'] = [$s["v92"], $s["p92"], $s["n92"], $s["l92"]]; $rhar['93'] = [$s["v93"], $s["p93"], $s["n93"], $s["l93"]]; $rhar['94'] = [$s["v94"], $s["p94"], $s["n94"], $s["l94"]]; $rhar['95'] = [$s["v95"], $s["p95"], $s["n95"], $s["l95"]]; $rhar['96'] = [$s["v96"], $s["p96"], $s["n96"], $s["l96"]]; $rhar['97'] = [$s["v97"], $s["p97"], $s["n97"], $s["l97"]]; $rhar['98'] = [$s["v98"], $s["p98"], $s["n98"], $s["l98"]]; $rhar['99'] = [$s["v99"], $s["p99"], $s["n99"], $s["l99"]]; function build_move_image($location, $vector, $styles) { $step1 = next_step($location, $vector); if ($step1['fwd']) { $step2 = next_step($step1['fwd'], $vector); } if (!empty($step2['fwd'])) { $step3 = next_step($step2['fwd'], $vector); } if (!empty($step3['fwd'])) { $step4 = next_step($step3['fwd'], $vector); } else { $step4['fwd'] = false; } $s = ''; if (!$step4['left']) { $s .= '
'; } if ($step4['left']) { $s .= ''; } if ($step4['right']) { $s .= ''; } if (!$step4['right']) { $s .= ''; } if (!$step3['right']) { $s .= ''; } if ($step3['right']) { $s .= ''; } if ($step3['left']) { $s .= ''; } if (!$step3['left']) { $s .= ''; } if (!$step2['right']) { $s .= ''; } if ($step2['right']) { $s .= ''; } if ($step2['left']) { $s .= ''; } if (!$step2['left']) { $s .= ''; } if (!$step1['right']) { $s .= ''; } if ($step1['right']) { $s .= ''; } if ($step1['left']) { $s .= ''; } if (!$step1['left']) { $s .= ''; } ///////stenq//////// if (!$step4['fwd']) { $s .= ''; } if (!$step3['fwd']) { $s .= ''; } if (!$step2['fwd']) { $s .= ''; } if (!$step1['fwd']) { $s .= ''; } $rs = mysql_query("select * from labirint where user_id='" . $_SESSION['uid'] . "'"); $t = mysql_fetch_array($rs); /* ///Удаляем убитых ботов с локации // Узнаем номер ледующей локи(где проводилась зачистка) $apol = mysql_fetch_array(mysql_query("SELECT * FROM `labirint` WHERE glava='$glava' and name='".$t['name']."'")); $comment1 = "лабиринт".$apol['boi']; //Ищем бой, проверяем кто победил $apol1 = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE coment='{$comment1}' and timeout='3'")); //Если победил мобов, то убираем их из таблицы лабиринт if($apol1['win']=='1') { mysql_query("UPDATE podzem3 SET `n".$apol['boi']."` = '' WHERE glava = '{$glava}' LIMIT 2"); } */ $f = mysql_query("SELECT * FROM podzem3 WHERE glava='$glava' and name='" . $t['name'] . "'"); while ($rt = mysql_fetch_array($f)) { if ($vector == '0') { $loc4 = $location + 30; } if ($vector == '0') { $loc3 = $location + 20; } if ($vector == '0') { $loc2 = $location + 10; } if ($vector == '180') { $loc4 = $location - 30; } if ($vector == '180') { $loc3 = $location - 20; } if ($vector == '180') { $loc2 = $location - 10; } if ($vector == '90') { $loc4 = $location + 3; } if ($vector == '90') { $loc3 = $location + 2; } if ($vector == '90') { $loc2 = $location + 1; } if ($vector == '270') { $loc4 = $location - 3; } if ($vector == '270') { $loc3 = $location - 2; } if ($vector == '270') { $loc2 = $location - 1; } $mesto = $location; if ($location == '01') { $mesto = '1'; } if ($location == '02') { $mesto = '2'; } if ($location == '03') { $mesto = '3'; } if ($location == '04') { $mesto = '4'; } if ($location == '05') { $mesto = '5'; } if ($location == '06') { $mesto = '6'; } if ($location == '07') { $mesto = '7'; } if ($location == '08') { $mesto = '8'; } if ($location == '09') { $mesto = '9'; } include "podzem/raschet_bot.php"; //////////////////////////////////////////////// $fd = mysql_query("SELECT * FROM podzem4 WHERE glava='$glava' and name='" . $t['name'] . "'"); $repa = mysql_fetch_array($fd); //////////////Объекты//////////////// if ($repa["n$mesto"] == '20') { mysql_query("UPDATE `users`,`online` SET `users`.`room` = '404',`online`.`room` = '404' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;"); print ""; exit; } /////// //Вход на 2ой этаж if ($repa["n$loc2"] == 'et2' and $vector == $repa["v$loc2"]) { $s .= ''; } //Вход на 1ый этаж if ($repa["n$loc2"] == 'et1' and $vector == $repa["v$loc2"]) { $s .= ''; } if ($repa["n$loc2"] == '20' and $vector == $repa["v$loc2"]) { $s .= ''; } if ($repa["n$loc3"] == '20' and $vector == $repa["v$loc3"]) { $s .= ''; } if ($repa["n$loc4"] == '20' and $vector == $repa["v$loc4"]) { $s .= ''; } if ($repa["n$loc2"] == 'el' and $vector == $repa["v$loc2"]) { $s .= ''; } if ($repa["n$loc3"] == 'el' and $vector == $repa["v$loc3"]) { $s .= ''; } if (($repa["n$mesto"] == '11.1' or $repa["n$mesto"] == '11.0') and $vector == $repa["v$mesto"]) { $s .= ''; } if (($repa["n$loc2"] == '11.1' or $repa["n$loc2"] == '11.0') and $vector == $repa["v$loc2"]) { $s .= ''; } if (($repa["n$loc3"] == '11.1' or $repa["n$loc3"] == '11.0') and $vector == $repa["v$loc3"]) { $s .= ''; } if (($repa["n$loc4"] == '11.1' or $repa["n$loc4"] == '11.0') and $vector == $repa["v$loc4"]) { $s .= ''; } ///////////// if (($repa["n$loc2"] == '12.1' or $repa["n$loc2"] == '12.0') and $vector == $repa["v$loc2"]) { $s .= ''; } if (($repa["n$loc3"] == '12.1' or $repa["n$loc3"] == '12.0') and $vector == $repa["v$loc3"]) { $s .= ''; } if (($repa["n$loc4"] == '12.1' or $repa["n$loc4"] == '12.0') and $vector == $repa["v$loc4"]) { $s .= ''; } ////////////////klju4i///////////////////////// if ($repa["n$mesto"] == 'key1' or $repa["n$loc2"] == 'key1' or $repa["n$loc3"] == 'key1' or $repa["n$loc4"] == 'key1') { $nomers = '1'; } if ($repa["n$mesto"] == 'key2' or $repa["n$loc2"] == 'key2' or $repa["n$loc3"] == 'key2' or $repa["n$loc4"] == 'key2') { $nomers = '2'; } if ($repa["n$mesto"] == 'key3' or $repa["n$loc2"] == 'key3' or $repa["n$loc3"] == 'key3' or $repa["n$loc4"] == 'key3') { $nomers = '3'; } if ($repa["n$mesto"] == 'key4' or $repa["n$loc2"] == 'key4' or $repa["n$loc3"] == 'key4' or $repa["n$loc4"] == 'key4') { $nomers = '4'; } if ($repa["n$mesto"] == 'key5' or $repa["n$loc2"] == 'key5' or $repa["n$loc3"] == 'key5' or $repa["n$loc4"] == 'key5') { $nomers = '5'; } if ($repa["n$mesto"] == 'key6' or $repa["n$loc2"] == 'key6' or $repa["n$loc3"] == 'key6' or $repa["n$loc4"] == 'key6') { $nomers = '6'; } if ($repa["n$mesto"] == 'key7' or $repa["n$loc2"] == 'key7' or $repa["n$loc3"] == 'key7' or $repa["n$loc4"] == 'key7') { $nomers = '7'; } if ($repa["n$mesto"] == 'key8' or $repa["n$loc2"] == 'key8' or $repa["n$loc3"] == 'key8' or $repa["n$loc4"] == 'key8') { $nomers = '8'; } if ($repa["n$mesto"] == 'key9' or $repa["n$loc2"] == 'key9' or $repa["n$loc3"] == 'key9' or $repa["n$loc4"] == 'key9') { $nomers = '9'; } if ($repa["n$mesto"] == 'key10' or $repa["n$loc2"] == 'key10' or $repa["n$loc3"] == 'key10' or $repa["n$loc4"] == 'key10') { $nomers = '10'; } if (($repa["n$mesto"] == 'key1' or $repa["n$mesto"] == 'key2' or $repa["n$mesto"] == 'key3' or $repa["n$mesto"] == 'key4' or $repa["n$mesto"] == 'key5' or $repa["n$mesto"] == 'key6' or $repa["n$mesto"] == 'key7' or $repa["n$mesto"] == 'key8' or $repa["n$mesto"] == 'key9' or $repa["n$mesto"] == 'key10') and $vector == $repa["v$mesto"]) { $s .= ''; } if (($repa["n$loc2"] == 'key1' or $repa["n$loc2"] == 'key2' or $repa["n$loc2"] == 'key3' or $repa["n$loc2"] == 'key4' or $repa["n$loc2"] == 'key5' or $repa["n$loc2"] == 'key6' or $repa["n$loc2"] == 'key7' or $repa["n$loc2"] == 'key8' or $repa["n$loc2"] == 'key9' or $repa["n$loc2"] == 'key10') and $vector == $repa["v$loc2"]) { $s .= ''; } if ($step2['fwd'] and ($repa["n$loc3"] == 'key1' or $repa["n$loc3"] == 'key2' or $repa["n$loc3"] == 'key3' or $repa["n$loc3"] == 'key4' or $repa["n$loc3"] == 'key5' or $repa["n$loc3"] == 'key6' or $repa["n$loc3"] == 'key7' or $repa["n$loc3"] == 'key8' or $repa["n$loc3"] == 'key9' or $repa["n$loc3"] == 'key10') and $vector == $repa["v$loc3"]) { $s .= ''; } if ($step3['fwd'] and ($repa["n$loc4"] == 'key1' or $repa["n$loc4"] == 'key2' or $repa["n$loc4"] == 'key3' or $repa["n$loc4"] == 'key4' or $repa["n$loc4"] == 'key5' or $repa["n$loc4"] == 'key6' or $repa["n$loc4"] == 'key7' or $repa["n$loc4"] == 'key8' or $repa["n$loc4"] == 'key9' or $repa["n$loc4"] == 'key10') and $vector == $repa["v$loc4"]) { $s .= ''; } if ($step3['fwd'] and ($repa["n$loc4"] == '13.1' or $repa["n$loc4"] == '13.0')) { $s .= ''; } if ($step3['fwd'] and ($repa["n$loc4"] == '14.1' or $repa["n$loc4"] == '14.0')) { $s .= ''; } //////////////////////3///////////////////////// if ($step3['fwd'] and $rt["n$loc4"] != '') { if ($k_b == '1') { $s .= ''; } if ($k_b == '2') { $s .= ''; $s .= ''; } if ($k_b == '3') { $s .= ''; $s .= ''; $s .= ''; } } $rogs = mysql_query("SELECT login,location FROM `labirint` WHERE `glava`='$glava'"); $i = 0; while ($mores = mysql_fetch_array($rogs)) { $i++; $nus = mysql_num_rows($rogs); if ($vector == 0) { $lac = $location + 30; } if ($vector == 90) { $lac = $location + 3; } if ($vector == 180) { $lac = $location - 30; } if ($vector == 270) { $lac = $location - 3; } if ($step3['fwd'] and $lac == $mores['location'] and $nus >= 2) { if ($nus == 2) { $l = '170'; } if ($nus == 3) { if ($i == 1) { $l = '140'; } if ($i == 2) { $l = '170'; } if ($i == 3) { $l = '200'; } } if ($nus == 4) { if ($i == 1) { $l = '140'; } if ($i == 2) { $l = '160'; } if ($i == 3) { $l = '180'; } if ($i == 4) { $l = '200'; } } $s .= ''; } } if ($step3['fwd'] and $repa["n$loc4"] >= '1' and $repa["n$loc4"] <= '10') { $s .= ''; } ///////////////////////////////////////////// if ($step2['fwd'] and ($repa["n$loc3"] == '13.1' or $repa["n$loc3"] == '13.0')) { $s .= ''; } if ($step2['fwd'] and ($repa["n$loc3"] == '14.1' or $repa["n$loc3"] == '14.0')) { $s .= ''; } /////////////////////2/////////////////////// if ($step2['fwd'] and $rt["n$loc3"] != '') { if ($k_b3 == '1') { $s .= ''; } if ($k_b3 == '2') { $s .= ''; $s .= ''; } if ($k_b3 == '3') { $s .= ''; $s .= ''; $s .= ''; } } $rogs = mysql_query("SELECT login,location FROM `labirint` WHERE `glava`='$glava'"); $i = 0; while ($mores = mysql_fetch_array($rogs)) { $i++; $nus = mysql_num_rows($rogs); if ($vector == 0) { $lac = $location + 20; } if ($vector == 90) { $lac = $location + 2; } if ($vector == 180) { $lac = $location - 20; } if ($vector == 270) { $lac = $location - 2; } if ($step2['fwd'] and $lac == $mores['location'] and $nus >= 2) { if ($nus == 2) { $l = '160'; } if ($nus == 3) { if ($i == 1) { $l = '130'; } if ($i == 2) { $l = '160'; } if ($i == 3) { $l = '190'; } } if ($nus == 4) { if ($i == 1) { $l = '120'; } if ($i == 2) { $l = '150'; } if ($i == 3) { $l = '180'; } if ($i == 4) { $l = '210'; } } $s .= ''; } } if ($step2['fwd'] and $repa["n$loc3"] >= '1' and $repa["n$loc3"] <= '10') { $s .= ''; $s .= ''; } /////////////////////////////////////////// if ($step1['fwd'] and ($repa["n$loc2"] == '13.1' or $repa["n$loc2"] == '13.0')) { $s .= ''; } if ($step1['fwd'] and ($repa["n$loc2"] == '14.1' or $repa["n$loc2"] == '14.0')) { $s .= ''; } /////////////////////1///////////////////// if ($step1['fwd'] and $rt["n$loc2"] != '') { if ($k_b2 == '1') { if ($rt["n$loc2"] == '8') { $s .= ''; } else { $s .= ''; } } if ($k_b2 == '2') { $s .= ''; $s .= ''; } if ($k_b2 == '3') { $s .= ''; $s .= ''; $s .= ''; } } $rogs = mysql_query("SELECT login,location FROM `labirint` WHERE `glava`='$glava'"); $i = 0; while ($mores = mysql_fetch_array($rogs)) { $i++; $nus = mysql_num_rows($rogs); if ($vector == 0) { $lac = $location + 10; } if ($vector == 90) { $lac = $location + 1; } if ($vector == 180) { $lac = $location - 10; } if ($vector == 270) { $lac = $location - 1; } if ($step1['fwd'] and $lac == $mores['location'] and $nus >= 2) { if ($nus == 2) { $l = '150'; } if ($nus == 3) { if ($i == 1) { $l = '90'; } if ($i == 2) { $l = '150'; } if ($i == 3) { $l = '180'; } } if ($nus == 4) { if ($i == 1) { $l = '100'; } if ($i == 2) { $l = '140'; } if ($i == 3) { $l = '180'; } if ($i == 4) { $l = '210'; } } $s .= ''; } } //////////////////////////////////////// if ($step1['fwd'] and $repa["n$loc2"] >= '1' and $repa["n$loc2"] <= '10') { $s .= ''; $s .= ''; } $mesto = $location; if ($location == '01') { $mesto = '1'; } if ($location == '02') { $mesto = '2'; } if ($location == '03') { $mesto = '3'; } if ($location == '04') { $mesto = '4'; } if ($location == '05') { $mesto = '5'; } if ($location == '06') { $mesto = '6'; } if ($location == '07') { $mesto = '7'; } if ($location == '08') { $mesto = '8'; } if ($location == '09') { $mesto = '9'; } //////////////0-ja//////////////// if ($step1['fwd'] and $repa["n$mesto"] >= '1' and $repa["n$mesto"] <= '10') { $s .= ''; } } return $s; } function next_step($location, $vector) { global $rhar; $row = intval(substr($location, 0, 1)); $col = intval(substr($location, 1)); $cell = []; // fwd $c = $col; $r = $row; if ($vector == 90) { $c = $col + 1; } elseif ($vector == 180) { $r = $row - 1; } elseif ($vector == 270) { $c = $col - 1; } else { $r = $row + 1; } $cell['fwd'] = $r . $c; if ($r > 9 || $r < 0 || $c > 9 || $c < 0 || !in_array($cell['fwd'], $rhar[$location])) { $cell['fwd'] = false; } // left $c = $col; $r = $row; if ($vector == 90) { $r = $row + 1; } elseif ($vector == 180) { $c = $col + 1; } elseif ($vector == 270) { $r = $row - 1; } else { $c = $col - 1; } $cell['left'] = $r . $c; if ($r > 9 || $r < 0 || $c > 9 || $c < 0 || !in_array($cell['left'], $rhar[$location])) { $cell['left'] = false; } // right $c = $col; $r = $row; if ($vector == 90) { $r = $row - 1; } elseif ($vector == 180) { $c = $col - 1; } elseif ($vector == 270) { $r = $row + 1; } else { $c = $col + 1; } $cell['right'] = $r . $c; if ($r > 9 || $r < 0 || $c > 9 || $c < 0 || !in_array($cell['right'], $rhar[$location])) { $cell['right'] = false; } // back $c = $col; $r = $row; if ($vector == 90) { $c = $col - 1; } elseif ($vector == 180) { $r = $row + 1; } elseif ($vector == 270) { $c = $col + 1; } else { $r = $row - 1; } $cell['back'] = $r . $c; if ($r > 9 || $r < 0 || $c > 9 || $c < 0 || !in_array($cell['back'], $rhar[$location])) { $cell['back'] = false; } return $cell; } }