Problem 327. TRON challenge
Create a solver for the classic arcade TRON game
Description
Your function should return the next move of your bike ('light cycle' if you prefer) for any given state of the board.
The board is described by a 50x50 matrix, with values:
0: empty space 1: your bike (bright blue dot on the figure above) 2: your opponents bike (bright red dot) -1: walls created by your bike (blue lines) -2: walls created by your opponents bike (red lines) -3: external walls (white)
Your bike's next move is described by a single character:
'N': moves up (next lower row) 'S': moves down (next higher row) 'W': moves west (next lower column) 'E': moves east (next higher column)
For each challenge, both bikes will start at a random position at the border of the board. Your solver will be called iteratively against a default solver (implementing a simple collision avoidance procedure). The last person standing after the other crashes against a wall is the winner. Your solver needs to be able to win 90 out of 100 challenges.
notes
For the purpose of collision detection both bikes are considered to move simultaneously for each iteration. A collision of the two bikes is considered a tie (not a win).
Whether you pass or not the tester will let you know how many wins/ties/looses your code accomplished against the default solver. Your score will be 100 - #Wins + #Looses (a score of 0 means you won all 100 challenges)
If you wish to display the challenges graphically copy and paste the evaluation code on your computer and change the first line to 'doDraw=true;'
Solution Stats
Problem Comments
-
4 Comments
Love the problem, love the graphics, great write-up, and great concept. awesome^2
Thanks!!
Whew! Toughie. Great problem.
Only complaint is 'loose' is what you call your shoelaces when you trip over them ;)
@Alfonso, does your website still support the test case? I get the following error:
Error using urlreadwrite_legacy The server did not find a resource to match this request. Error in urlreadwrite (line 88) [output,status] = urlreadwrite_legacy(fcn,catchErrors,varargin{:}); Error in urlwrite (line 52) [f,status] = urlreadwrite(mfilename,catchErrors,url,filename,varargin{:}); Error in Test1 (line 2) urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0&d=1','SetSolutionScore.p');
Solution Comments
Show commentsProblem Recent Solvers17
Suggested Problems
-
Sum of diagonal of a square matrix
1569 Solvers
-
Volume difference between Ellipsoid and Sphere
127 Solvers
-
117 Solvers
-
Celsius to Fahrenheit converter
605 Solvers
-
9292 Solvers
More from this Author38
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!