PDA

View Full Version : حرفه ای: مشکل در ربات حل ماز با php



alinwp
سه شنبه 26 اسفند 1393, 16:53 عصر
درود من یه ربات حل ماز با php نوشتم که مرحله به مرحله کار رو نشون بده که از $ شروع و به # ختم میشه ولی مشکلش نمیدونم چیه کد رو هم گذاشتم

$file = "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------- ----- ------------------------------- ----- ------------------------------- # ----- --------------------------------------- $ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";$pos = strpos($file, "$");$end = strpos($file, "#");$move = "";while($end != $pos){ if($move != "d"){ if(substr($file,$pos-31,1) != "-"){ $pos -= 31; $move = "u"; echo substr_replace($file,"$",$pos,1)."\n"."\n"; } } if($move != "r") { if (substr($file, $pos - 4, 1) != "-") { $pos -= 4; $move = "l"; echo substr_replace($file, "$", $pos, 1) . "\n" . "\n"; } } if($move != "l") { if (substr($file, $pos + 4, 1) != "-") { $pos += 4; $move = "r"; echo substr_replace($file, "$", $pos, 1) . "\n" . "\n"; } } if($move != "u") { if (substr($file, $pos + 31, 1) != "-") { $pos += 31; $move = "d"; echo substr_replace($file, "$", $pos, 1) . "\n" . "\n"; } }}
لطفا کمک کنید

j_naroogha@yahoo.com
چهارشنبه 27 اسفند 1393, 11:28 صبح
عزیز کدتون رو در تگ php قرار بدین.