About Tron game: Tron is a two player game based on the popular movie Tron. The objective of the game is to cut off players movement through each others motorbikes that leave a wall behind them as they move. Like this: I came across this question in Hackerrank , where our programs will read the players position at each turn and will decide the movement, by printing one of (LEFT, RIGHT, UP, DOWN) to the console, and we can see the result visually. Before we go further, I should tell you that the solution below is a naive and basic approach (scored 36/50) and there are a lot of algorithms available that provide better results. Now the input we get are: player's turn bot player's current positions the whole grid (15x15) values Input is: r 4 3 5 13 ############### #-rr--------gg# #-rr--------gg# #-rr--------gg# #-rr--------gg# #-r---------g-# #-r---------gg# #rr----------g# #-------------# #-------------# #-------------# #-------------# #-------------# #---...
Dilli's blog, containing articles about various programming languages and other interesting tech. stuff.