disclaimer: this script is distributed in the hope that it will be useful, but it is provided "AS IS" and WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
more info: see: http://codewalkers.com/forum/?forum=php-contest
\* */
files:
index.php if you want a quick star, just browse to this file
README this file
frames.htm left is grid, right is start, blah, blah...
grid.php spits 30*30 grid with images and id's for javascript
start.htm asks you for the names of robot scripts
judge.php main judging script...
random/ example robot playing as white (going down + right)
rnd.red/ same thing, but for red (up + left)
*.gif and some bells and whistles global.css
how to use:
name your robot scripts capture.php (as the rules say), place them in DIFERENT dirs (as random/ and rnd.red/ ) and start from the index.php. enter the names of the robot dirs in the text boxes, and fire it up.
in the grid, white is represented as W, red as R, flags with green, sticky traps with yellow and teleports with blue cells.
the button 'next' advances one STEP, not one turn. when you check checkbox 'auto', and click on 'next', script goes in auto mode, where it waits 1 sec after page gets loaded, and then advanced to the next step. (if you want to change this pause, find and change setTimeout() call in the judge.php function control());
the table below, show names of two robots (dir names), their location, number of used sticky and teleport traps, death rays, and enemy locators for each robot script.
last two rows show the move one robot made, and the response that robot WILL receive on the NEXT turn (maybe i could do this the opposite way, but this was logical to me)...
clicking on 'start over' below the grid gets you to the point where you enter the names of robots to star over.
known issues:
browsers: because of javascript, this was an issue, and it took me some time, but now it is tested (and works) in IE 6.0, Mozzila 1.0 and Opera 6.0 on Windows 2000. it should work in NN 6.0+, and could in NN 4.0+
500 limit: there is NO limit to 500 turns, as the rules say, because i wasn't going to make that kind off robots...
STUCK: the judging script shows as the robot IS called on the turn when he is STUCK, but that is NOT the case, it just looks like that (had to do it that way ;)
consequences:
as it took me some time to recode this script to work in most browsers (i was ashamed to release a script that doesn't), the result is that maybe i am not going to have time to write a decent robot, and thus, not win.
so, if you use this judging script, and you DO win, i would be very happy if you would give me a 'php addict' t-shirt (the one you will receive for winning) as that is all i need. ;)))
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.