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

28.57% Correct | 71.43% Incorrect
Last Solution submitted on Aug 09, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers17

Suggested Problems

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!