algorithm - Generating Random Puzzle Boards for Rush Hour Game -


if you're not familiar it, game consists of collection of cars of varying sizes, set either horizontally or vertically, on nxm grid has single exit. each car can move forward/backward in directions it's set in, long car not blocking it. can never change direction of car. there 1 special car, it's red one. it's set in same row exit in, , objective of game find series of moves (a move - moving car n steps or forward) allow red car drive out of maze.

i've been trying think how generate instances problem, generating levels of difficulty based on minimum number solve board.

any idea of algorithm or strategy that?

thanks in advance!

example of rush hour puzzle

the board given in question has @ 4*4*4*5*5*3*5 = 24.000 possible configurations, given placement of cars.

a graph 24.000 nodes not large todays computers. possible approach

  • construct graph of positions (nodes positions, edges moves),
  • find number of winning moves nodes (e.g. using dijkstra) ,
  • select node large distance goal.

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -