Bloxorz Solution

Bloxorz Solution

Bloxorz is a single player ‘casual’ game written in Flash by DX Interactive that came out in 2007.

It caught my interest as a challenge to implement a software algorithm to complete it – and as it turns out, I reckon that the optimum path through all 33 levels is determinable by brute force.

Since the game doesn’t (to my knowledge) provide any external interfaces I had to model the game rules – and so my solution is only as accurate as my model of the real game.   The model and search algorithm is written in Java, the software is freely available on request.

Algorithm Design

I used A* with a simple heuristic based on the straight line distance to the goal. As it turns out, for most cases, although admissible, this heuristic was fairly ineffective compared to a straight Dijkstra algorithm.

The interesting challenges were dealing with the ‘switches’ – which change layout of the grid in the middle of a game, and the ‘teleports’ which break to block up in to 2 pieces on different squares.   Switches were dealt with by encapsulating the hash of the grid state in each search node.   Teleports were dealt with by encapsulating the location of both blocks in a single search node; the ensuing combinatorial explosion turned out to be manageable without any bespoke pruning. Teleports also required that the heuristic be made more sophisticated in order to remain admissible because a teleport could provide a shorter path to the target than a straight line.

Game Suggestions

The game could be extended to make it more difficult to solve via brute force in a number of ways:

  • Make the grid much larger
  • Complex interactions between the grid ‘controls’ – e.g. teleport 1 goes to site 2 and 3 if switch 1 is activated but not if switch 2 is.
  • Add grid ‘controls’ with a timing element – e.g. swing bridges
  • More complex blocks – specifically, a 3×1 block teleported to 3 1×1 blocks would cause an almighty combinatorial explosion.

The game author notes that creating the levels is very time consuming and tedious. A search algorithm could be used ‘in reverse’ so to speak to automatically generate very difficult levels. The algorithm would work as follows:

  1. generate a set of random grids
  2. search them to find the subset which are completable
  3. loop:
    1. create a new set as mutations of input set
    2. search them to find the subset which are completable
    3. break if set contains solution of required difficulty ( e.g. require number of moves )

Solutions

level1.txt : [R2, D, R3, D] : 7 : 7
level2.txt : [U, R, D, R4, U2, D, R, D, R2, U, R, U] : 17 : 24
level3.txt : [R, U, R3, U, L, D, R, U2, R3, D3, R, U] : 19 : 43
level4.txt : [U, L, U, R2, U, R6, D, R, D5, R, U, L6, D] : 28 : 71
level5.txt : [L3, R, L5, D, R, D2, R4, D, R4, L4, D, L6] : 33 : 104
level6.txt : [R3, D2, R, D2, R, D, R, U, L3, U2, L, U3, R2, D, R2, U, L, D2, R2, D2, R] : 35 : 139
level7.txt : [D, L, U, R5, D, R, L, U, L5, D, R, D, R, D, R3, U2, R, D, L, U, R, U2, R3, D, R, D, R, D, L, U] : 44 : 183
level8.txt : [R2, D5, U, R, U, R] : 11 : 194
level9.txt : [R, D, R6, U, R, L, D, L4, U, S, R, D, R4, D] : 24 : 218
level10.txt : [R2, L, D3, R, D5, L4, U, L3, D, U, R3, D, R3, U, S, R, D, R, D2, R, D3, L, D, U, R, U4, L2, U, L, D, L5] : 57 : 275
level11.txt : [R4, U, L, D3, R3, D, L, U, L3, U2, R, U, R2, D, R, U, L3, D2, L3, U2, R, U2, L, D, R, U, R, D, L] : 47 : 322
level12.txt : [L, D, R, U, R, U, R, U, L, D, R, U, R, U, R3, D3, L, U, R, U3, L3, R3, D3, L, D, R, U, R, D, L, U, R, U2, R, U, D, L, D3, L, U, R, U, L, U, L3, D2, L] : 65 : 387
level13.txt : [U2, L, D, R, D, R, D, L, U4, L7, D3, R, U, L, D, R, D2, R, D2, R, U, R5, U, L, D, L, U2] : 46 : 433
level14.txt : [R4, U, L2, D, R3, D4, L3, D, R, U, R2, U2, D, R, D, L2, D2, R2, L2, U, L2, U, R3, U4, L6, U, R, D, L5, D3, R, D, R] : 67 : 500
level15.txt : [R4, U2, S, U5, R3, U2, R4, D2, U, L, U, S, L4, D, L, D, U, S, L3, D, S, U, L4, D, L2, D3, L, D, R, U, R7] : 59 : 559
level16.txt : [R4, S, R, D, S, R, U, S, R, L3, R4, L5, D, S, R, U, S, R4] : 28 : 587
level17.txt : [D5, L, U, R5, U, R3, L3, D, L5, U4, R5, D, R4, D, L, U, R, D, U, R, D, L, U2, R, D, L2, U, R, D, L4, U, L5, D4, R5, U, R3, D2, U, L, U, L3, D, L3, U, L, U3, R5, D, R3] : 106 : 693
level18.txt : [U, L, D, R4, U2, D2, L3, U, R, D, L2, U, R, D, R3, D2, U2, L3, U, L, D, R, U, L2, D4, R2, L2, U4, R2, D, L, U, R, D2, L, U, R, D, R, U, R5, D3, R, U, L, D2, R, U, L, D, L, U, R] : 85 : 778
level19.txt : [R8, D, R, U, L6, D, R, U, R5, D5, L5, D, L, U, R6, U, L, D, L5, D4, R3, L6, U2] : 67 : 845
level20.txt : [D, L, D, R, D, L, U2, R, U2, L4, D2, R, U, L2, D3, L, D, U, R, U2, R, U2, R3, D, L, D, L4, D3, S, U, L, D, S, D2, R4, D] : 56 : 901
level21.txt : [R, D, L, U, L, D, R, U, R2, U, R3, U, L, D3, U3, R, D, L3, D, L2, D, L, U, R, D, R, U, L, D, R, U, L, D, R, D2, R, D2, R3, U, R, D, L4, U, R, D, R3, U4, R3] : 72 : 973
level22.txt : [R, U, R4, D, R, D3, L, D, U, R, U3, L, U, R, D, L, U, L, U, L2, D, L3, D, R, U, R, D, L, D3, R, D, U, L, U3, R, U, L, D, R, U, R, U, R3, D, R4, U] : 65 : 1038
level23.txt : [R, D2, R, U, R5, U, L, D, R, L, U, L2, U4, R4, U, L, D, L3, D3, L, D, L8, U3, R2, U, D, L, U, R, D2, R, D3, R2, D, R, U6, R, D, L, U] : 75 : 1113
level24.txt : [D, L, D, R, D, L, U2, D2, R, U, L, U, R, D, R2, U2, R, U, L, D, R, U, R4, L5, D, R, L, U, R, D, L, U, R7, D, L, R, U, R3] : 57 : 1170
level25.txt : [U, R, D, L, U, R, D, L, U, R4, U, L, U, L2, U, R, L, D, R2, D, R, D, L4, D, R, U, R3, U2, R3, U, R, D, L, U2, R, D, L, U, R, D, L] : 55 : 1225
level26.txt : [U2, L3, D, L3, D, R, U, R2, U2, R2, D, R2, D, R2, U2, L2, U, L5, D, L3, D, L, D2, S, U3, L6, D, L2, D2, L, D, U2, R, U, R3, U, R3, D, R2, U2, L2, U, L3, D, L, D3, R2, D, R, S, U3, L3, D, L, D3, R2, D, L] : 104 : 1329
level27.txt : [R5, U, L, D, R, U, R, D, L6, U, R, D, L2, U, R, D, R4, U, R4, D3, L, D3, L3, D, L, U4, R, D, L7, U, L, D2, R, U, L, D, R, U, L] : 71 : 1400
level28.txt : [L, D3, R, D, L, U, R, D2, R2, D2, R3, U3, L, U, L, U, L, U, L, D, R2, D, R, D, R, D, R2, D, L, D, L2, U3, L, U, L, U, L2, U, L2, D, L, U, R3, D, R, D, R, D, R, D, R, L4, D3, L4, U, L, U, L3, D, S, L6, U, L, U, L3, U] : 100 : 1500
level29.txt : [R, U, L, D, L, U, R, D, R, D2, R2, L2, U2, L, U, R, D, L, U, L, D, L, U2, L2, R2, D2, R, U, R, D, R, U, L, D, R, U2, R2, L2, D6, R2, L2, U4, L6, R4, D, L, U, R6, L5, U, L, D4, L3, D, R, U, L, D, R, U, L] : 104 : 1604
level30.txt : [D, R, D2, R2, U, R2, D, R4, U, D, L4, U, L3, D2, L, U, R6, U3, R3, U, R, D3, L2, D, L, D, R, U2, R, D, L, D, L4, U, L2, D, L2, U, L, D, L, U, R, U, D, L, D, R, U, R, D, R2, U, L, D2, L, U, R7, U, L, U3, R3, U, R, U, L5, D, L] : 114 : 1718
level31.txt : [U, L, D, L2, U4, D4, R3, U, L, D, R, U4, R, U, L, D2, R, U, L, D, L3, D3, L, D2, U2, R, U3, L4, D, R, U, L, D5, L, U, R, L, U, R, D, R, U, R2, U, R2, D, R3, U, L, D, R, U5, R, D, L] : 91 : 1809
level32.txt : [U2, L, D, R, U, R, U, R, D, L, R, U, L, D, L, D, L, U, R, D, L, U, R, U, R, U, R, D, L2, D3, L, D, L2, U, L, D, R3, U5, R, U, R2, U, D, L2, D, L, D5, L4, U, R, L, D, R4, U5, R, U, R2, U, D, L2, D, L, D5, L3, U, R, D, R2, U, R, U3, R2, U, L, D, L, D, L, D, R, U, L2, U, L5, D] : 129 : 1938
level33.txt : [R4, U, L, D2, L, U, R, U2, R2, D, R, D, R, U, L2, U, R, D, R, D2, R, D, L, D2, R2, U, D, L2, U2, R, U, L, U2, L, U, L, D, R, U, L3, D3, L, D, L2, D, L, U] : 65 : 2003

Level Description Key

Below I’ve included the description file used to model each level. These descriptions are interpreted according to the following key:

  • x = missing (i.e. no tile)
  • p = plain tile
  • s = starting point
  • e = end point (target)
  • t = teleport
  • S = strong switch ( i.e. block needs to be end-on)
  • W = weak switch (i.e. any contact will trigger)
  • w = weak tile (i.e. will break if arrived at end on)

Where a tile type is followed immediately by another character (e.g. W1) that tile can be uniquely identified – this is necessary for defining rules.

Rules are defined after the grid, after a line containing dashes ( i.e. ‘—-’ )

Example:

x  x  p  p  x  x  x  x  x  x  x  x  x  x
x  x  p  p  x  x  x  x  x  x  x  x  x  x
x  x  p  p  p  x  x  x  x  x  x  x  x  x
x  x  p  p  W1 x  x  x  x  x  p  p  p  x4
x  x  x  p  p  p  p  x3 x  x  p  e  p  x4
x  x  x  x  x  x  p  p  x2 x2 p  p  p  x
x  p  p  x  x  x  p  p  x  x  x  x  x  x
p  p  S1 p  p1 p1 p  p  x  x  x  x  x  x
p  s  p2 x  x  x  p  p  x  x  x  p  p  p
p  p  p2 x  x  x  p  p  W2 p  p  p  p  p
x  x  x  x  x  x  x  x  x  x  x  p  p  p
--------
W1 toggles x2, x4
W2 closes p1
W2 opens x3
S1 opens x2

Levels

level 1
p p p x x x x x x x x x x x x x x
p s p p p p x x x x x x x x x x x
p p p p p p p p p x x x x x x x x
x p p p p p p p p p x x x x x x x
x x x x x p p e p p x x x x x x x
x x x x x x p p p x x x x x x x x

level 10
p p p x x x x x p p p p p p
p e p x1 x1 p x2 x2 p s1 p p t1 p
p p p x x x x x p p p p x2 x
x x x x x x x x x p p p x2 x
x x x x x x x x x x x p p x
x x x x x x x x x x x x p x
x x x x x x x x x x x x p x
x x x x x x x x x x x p p x
x x x x p p p p p x x p p x
x x x x p W1 x x p p p S1 p x
—–
t1 teleports t1, s1
W1 toggles x1
S1 toggles x2

level 11
x p p p p1 x x x x x x x
x p e p p1 x x x x x x x
x p p p x x x x x x x x
x p x x x p p p p p p x
x p x x x p p x x p p x
s p p p p p p x x p p p
x x x x x p W1 x x x x p
x x x x x p p p p x x p
x x x x x p p p p p p p
x x x x x x x x p p p x
—–
W1 closes p1

level 12
x x x x x x x x x x x x S2
x x x x x p p p x x p p p
x x x x x p S1 p p p p p x2
x x x p p p p p x x p p x
x x x p e p x1 x x x p p x
x p p p p p x x x p p p p
p p s p x x x x x p p p p
p p p p x x p p p p p x x
x x x x x p p p x x x x x
x x x x x p p p x x x x x
——–
S1 toggles x2
S2 toggles x1

level 13
p p p w p p p p w p p p p x
p p x x x x x x x x p p p x
p p x x x x x x x x x p p p
p p p x x x p p p x x p s p
p p p w w w p e p x x p p p
p p p x x w p p p x x p x x
x x p x x w w w w w p p x x
x x p p p w w p w w w x x x
x x x p p w w w w w w x x x
x x x p p p x x p p x x x x

level 14
x x x x x x x x p p p x x x
x x x p p p x x p p p x x x
p x1 x1 p s p p p p p p p p p
p x2 x2 p p p x x x x x x S1 p
p x x x x x x x x x x x p p
p x x x x x x x x x x x p p
p x x x x x x x p p p p p p
p p p p p x x x p p p x x x
x p p e p x x x p p p x x x
x x p p p x x x p p p p p S2
——
S1 toggles x1
S2 toggles x2

level 15
x x x x x x x p p p x x p p p
x x x x p p2 p2 p p p x2 x2 S4 p1 p
p p x3 x3 p x x p p p x x p p p
p p p p p x x x W1 x x x x x x
p p x x x x x x x x x x x x x
x p x x x x x t1 x x x x x x x
x p x x x x x p x x x x x x x
p p p x x x p p p x x W2 p p x
p s1 p p p p p p p p3 p3 p e p x
p p p x x x p p p x x W3 p p x
——-
t1 teleports p1, s1
W1 toggles x2, p2
W2 closes p3
W3 closes p3
S4 toggles p2, x3

level 16
x t1 x x x x x x x x p p p
t2 p t3 x1 x1 S1 S2 p1 x2 x2 p e p
x t4 x x x x x x x x p p p
x x x x x x x x x x x x x
x x p p p x x x p p p x x
x x p s p p p p p t5 p x x
x x p p p x x x p p p x x
——
t1 teleports p1, S1
t2 teleports t3, t1
t3 teleports t2, t3
t4 teleports t4, t2
t5 teleports t1, t2
S1 opens x1
S2 opens x2

level 17
p p p x x x x x x x x x x x x
p s p p p p p p p x4 x x p p p
p p p x x x x x1 p p p p p e p
p p p x x x x x x x x x S1 S2 p
p p p x x x x x x x x x x x x
p p p x x x x x x x x x x x x
p p p x x x x2 p p p p p S3 x x
p p p p p p p p x3 x x p p x x
p W1 p x x x x x x x x p p x x
p p p x x x x x x x x p S4 x x
——
S1 closes x2
S2 opens x2
S4 closes x3
S4 opens x4
S3 opens x1
W1 toggles x3

level 18
x x x x x x x W1 x x x x x x x
p p W6 p x x x p x x x x x x x
p p p p p x x p x x x x x x x
p W2 s p p p p p x1 x1 p p x3 x3 p
p p p p p x5 x x p x x x p x x
p p W3 p x x x x p x x x p x x
p x x x x x x x W4 x x p p p x
p x x x x x x x x x p p e p x
p x6 x6 S5 x x x x x x p p p p x
——-
W6 closes x6, x3
W3 closes x6, x3
W1 opens x1
W2 closes x1
W4 opens x6, x3
S5 toggles x5

level 19
x s p p p p p p p p W1 p p p p
x x x x x p p x x x x x x p p
x x x x x p p x x x x x x p p
x x x x x x x x x x x x x p p
x x x x x x x x x x x x x p p
p p p x x p p x1 x1 p W2 p p p p
p e p x x p p x x x x x x x x
p p p x x p p x x x x x x x x
x p p x x p p x x x x x x x x
x p p2 p2 p p p p p p W3 p p p x
—–
W1 toggles x1
W2 closes p2
W3 opens p2

level 2
x x x x x x p p p p x x p p p
p p p p x x p p S2 p x x p e p
p p W1 p x x p p p p x x p p p
p p p p x x p p p p x x p p p
p s p p x1 x1 p p p p x2 x2 p p p
p p p p x x p p p p x x x x x
—-
W1 toggles x1
S2 toggles x2

level 20
x x x x x x x x x x x x p p p
x x p p p p3 p3 p p p x1 x1 p l5 p
x x p p p x x W1 s p x x p p p
x x p p p x x p p p x x x x x
x x p W2 p x x t1 p W3 x x x x x
x x p p p x x p p p x x x x x
p p p p x x x p p p x2 x2 W4 p p
p W5 x x x x x x x x x x p l4 p
x x x x x x x x x x x x p e p
x x x x x x x x x x x x p p p
—-
W3 closes p3
W1 closes p3
W2 closes p3
t1 teleports l5, l4
W4 toggles x2
W5 opens x1

level 21
x x x x x x x x p p x x x x x
x x x x x x x p p p x x x x x
p p x x p p p p p p x x x x x
p s p p p p x x p x x x x x x
p p p p x x x x p x x x p p p
x p p x p p p p S1 p p p p e p
x x p x x x x x S1 p x x p p p
x x p p p x x x p p x x x x x
x x x p p p x2 x p p x x x x x
x x x x1 p p p p p p x x x x x
—-
S1 toggles x1
S2 toggles x2

level 22
x x x x x p p x x x x p p p
x x x p p p p p p x x p e p
p p p p p p W1 p p p p p p p
p s p p W2 x x p p p p p x2 x
p p p x x x x x x p p p x x
x p x x x x x x x x p x x x
x p x x x x x x x x p x x x
x p x1 x x x x x x p1 p x x x
x p p x x x x x x p p x x x
x x S3 x x x x x x S4 x x x x
——-
W2 closes x2, x1
W1 closes x2, x1
S4 toggles x1
S3 toggles x2

level 23
x p p p x x x x x x x x p p p
x p S1 p x x x x x x x x p W1 p
x p p2 p x x x p p p p1 p1 p p p
x3 p p p x4 x x p e p x x p p W2
p x x x p x x p p p x x x x p1
W3 x x x p x x w w w x x x x p
p x2 x2 p p p w w w w w p p p p
x x x p s p w w w w w p t1 p x
x x x p p p w w w w w p p p x
x x x p p p p p x1 x x x x x x
——–
W2 closes p1
W1 toggles x1
W1 opens x2
t1 teleports t1, p2
W3 opens x3
W3 closes x2
S1 opens x4

level 24
x x x x x x x x x x p p p p
x x x x2 p p p p p p p S1 p t1
x s x1 x1 p S2 p x x x p p p p
S3 p x x p p x x x x x x p x
p p x x p x x x x x x x p x
p p p p p x x x x x p p p x
p p p x x l1 p l2 x4 x4 p e p x
x x x x x S4 p x3 x x p p p x
x x x x x x x x x x x x x x
—–
t1 teleports l1, l2
S1 toggles x1
S3 opens x2
S2 opens x3
S4 opens x4

level 25
x x p p x x x x x x x x x x
x x p p x x x x x x x x x x
x x p p p x x x x x x x x x
x x p p W1 x x x x x p p p x4
x x x p p p p x3 x x p e p x4
x x x x x x p p x2 x2 p p p x
x p p x x x p p x x x x x x
p p S1 p p1 p1 p p x x x x x x
p s p2 x x x p p x x x p p p
p p p2 x x x p p W2 p p p p p
x x x x x x x x x x x p p p
——–
W1 toggles x2, x4
W2 closes p1
W2 opens x3
S1 opens x2

level 26
x x x x x p p p p x x x x t1
x x x x x p p W1 p p p x x p
x x x x p p p p p p p x x p
p p p1 p1 p p p p x x p p p2 p
p p p x3 x x p x x x p p x x
p p p x x x p x x x s1 x x x
x p x x x x p p p x x x x x
x S1 x x x x p e p x3 x x x x
x x x x x x p p p x x x x x
——-
W1 closes p1
t1 teleports p2, s1
S1 opens x3

level 27
p p p x x x x p p p p p p p p
p s p p p p p p p p p x x p p
p p p x x x x p p x x x x p p
x x x x x x x x x x x x p S1 p
x x x x x x x x x x x x p p x
p p p x x w w w w p x x W1 W2 x
p e p w w w w w w w x x p p p
p p p w w w w w w w w w p p p
x x x x x w w w w w w w p p p
x x x x x x p1 p p p2 x x x x x

S1 closes p1, p2
W2 closes p2
W1 closes p1

level 28
x p p p1 p1 p p x x x x x x x x
x p p x x p p p x x x x x x x
w w s x x p p p p x x x x x x
w w x x x x x p p p x x x x x
w w x x x x x x p p p x x x x
w p p p x x x x x p p t1 x x x
x p e p x x x x x x p p p p p2
x p p p p p p x x x p W1 p p p
x x p x x p p x x x p p p x x
x x p x x p p p p1 p1 p p p3 x x
——
W1 closes p1
t1 teleports p2, p3

level 29
x x W1 p1 p1 p x x x p x1 x1 S1 x x
x x x x x p x x x p x x x x x
x x x x x p p p p p x x x x x
S2 x2 x2 p p p p s p p p p x3 x3 S3
x x x x x p p p p p x x x x x
x x x x x x6 p x x p x x x x x
x x x x x x6 p x x p p2 p2 W2 x x
p p p x x p p x x p x x x x x
p e p x4 x4 p x x x p x x x x x
p p p x5 x x x x x p p3 p3 W3 x x
—–
W2 opens x2
W3 opens x3
W3 closes p2, x1, p1
S2 opens x4
W1 closes p2
S2 closes p3
S3 opens x5
W1 opens x1
S1 opens x6

level 3
x x x x x x p p p p p p p x x
p p p p x x p p p x x p p x x
p p p p p p p p p x x p p p p
p s p p x x x x x x x p p e p
p p p p x x x x x x x p p p p
x x x x x x x x x x x x p p p
x x x x x x x x x x x x x x x

level 30
x x x p p p p p w w p p p p x
x x x p e p p x x x x x w p x
x x x p p p x x x x x x w p S1
x x x x x x x w p p p1 p1 p p p
x x s x x x x w w x x x x x p
x S2 p w x x x w w x x x x x p
w w w w x x x p p x2 x x x2 p p
w w w p w p w w p w x x S3 p x1
p w w w w w w w w w w w p x x
x w p w w w x x w w w w p x x
—–
S3 toggles x1
S1 closes p1
S1 opens x2
S2 opens p1

level 31
x x x x x x x x x x x p p p x1
x p p p x x x x S1 x x p e p x1
x p p p p3 p3 p p p x3 x3 p p p x1
x p p p x x p p p x x x p x x
x w w w x x W1 p p x x x w x x
x x w x x x p p p x x w w w x
x x p x x x p p p x x p p p x
p2 p p p x2 x2 p W2 p p1 p1 p s p x
p2 p S2 p x x S3 x x x x p p p x
p2 p p p x x x x x x x x x x x
—–
W2 closes p1, x2, p3, x3
W1 closes p1, x2, p3, x3
S1 toggles x3
S3 toggles x2
S2 opens x1
S2 closes p3

level 32
x x x x x x x x x x x x p S1
x x p p p1 p1 p p x x x p p p
x p p p x3 x3 p p x x p S2 p p
x p e p x x x p p p p p x x
x p p p x x x x p p p x x x
x x x x x x x x x p p x x x
x x x x p p p x x p s x x x
p p x1 x1 p S3 p x x p p x x x
p p x2 x2 p p p p p p p x x x
—–
S1 toggles p1, x1
S2 toggles x2
S3 toggles x3

level 33
x x x x x p p W1 p p p x x x x
x x x x x p p p p p p x1 x x x
p p p x x W2 p p W3 p p p p p x
p s p p1 p1 p p p p W4 W5 p p W6 x
x x x x x p p W7 p p W8 p p p x
x x x x x p p p p p p W9 p p x
p p p x x p p p p p p Wa p p p
p e p p2 p2 p Wc p x x p p p Wb S1
p p p x x p p p x x x p p p p
p p p x x x x x x x x x p p p
—-
S1 opens x1
W1 closes p2
W2 closes p2
W3 closes p2
W4 closes p2
W5 closes p2
W6 closes p2
W7 closes p2
W8 closes p2
W9 closes p2
Wa closes p2
Wb closes p2
Wc closes p2

level 4
x x x w w w w w w w x x x x
x x x w w w w w w w x x x x
p p p p x x x x x p p p x x
p p p x x x x x x x p p x x
p p p x x x x x x x p p x x
p s p x x p p p p w w w w w
p p p x x p p p p w w w w w
x x x x x p e p x x w w p w
x x x x x p p p x x w w w w

level 5
x x x x x x x x x x x p p p p
x p p p p p1 p1 p W1 p p p p s p
x p p W2 p x x x x x x x p p p
p p p p p x x x x x x x x x x
x p p p p x x x x x x x x x x
x x x p p p W3 p p p p p p x x
x x x x x x x x x x p p p p W4
p p p x x x x x x x p p p p p
p e p p p p4 p4 p p p p p p x x
—-
W4 toggles p4
W3 closes p4
W2 opens p4
W1 toggles p1

level 6
x x x x x p p p p p p x x x x
x x x x x p x x p p p x x x x
x x x x x p x x p p p p p x x
s p p p p p x x x x x p p p p
x x x x p p p x x x x p p e p
x x x x p p p x x x x x p p p
x x x x x x p x x p p x x x x
x x x x x x p p p p p x x x x
x x x x x x p p p p p x x x x
x x x x x x x p p p x x x x x

level 7
x x x x x x x x p p p p x x x
x x x x x x x x p p p p x x x
p p p x x x x x p x x p p p p
p s p p p p p p p x x x p e p
p p p x x x x p p S1 x x p p p
p p p x x x x p p p x x p p p
x p p x1 x x x p x x x x x x x
x x p p p p p p x x x x x x x
——
S1 toggles x1

level 8
x x x x x x x x x p p p x x x
x x x x x x x x x p l1 p x x x
x x x x x x x x x p p p x x x
p p p p p p x x x p p p p p p
p s p p t1 p x x x p p p p e p
p p p p p p x x x p p p p p p
x x x x x x x x x p p p x x x
x x x x x x x x x p l1 p x x x
x x x x x x x x x p p p x x x
——
t1 teleports l1

level 9
p p p p x x x p x x x p p p p
p s l2 p x x x p x x x p l1 t1 p
p p p p p p p p p p p p p p p
x x x x x x p e p x x x x x x
x x x x x x p p p x x x x x x
——–
t1 teleports l1, l2

About these ads

7 Responses to “Bloxorz Solution”

  1. Nuala Says:

    Graham – that’s taking all the fun out of it!
    Get a shorter commute!

  2. davbol Says:

    extremely clever! so how many total moves is that? (did you find a solution less than 1999 moves?)

  3. rrabarg Says:

    Hi davbol

    My solution has 2003 moves (excluding switching blocks). The best solution that I’ve seen posted has 2264 moves.

    Could you let me see the solution with 1999 moves so that I can verify it – I’d be interested to know if there is a flaw in my algorithm.

    Detailed counts below:

    My solution move counts:
    level1.txt : 7 : 7
    level2.txt : 17 : 24
    level3.txt : 19 : 43
    level4.txt : 28 : 71
    level5.txt : 33 : 104
    level6.txt : 35 : 139
    level7.txt : 44 : 183
    level8.txt : 11 : 194
    level9.txt : 24 : 218
    level10.txt : 57 : 275
    level11.txt : 47 : 322
    level12.txt : 65 : 387
    level13.txt : 46 : 433
    level14.txt : 67 : 500
    level15.txt : 59 : 559
    level16.txt : 28 : 587
    level17.txt : 106 : 693
    level18.txt : 85 : 778
    level19.txt : 67 : 845
    level20.txt : 56 : 901
    level21.txt : 72 : 973
    level22.txt : 65 : 1038
    level23.txt : 75 : 1113
    level24.txt : 57 : 1170
    level25.txt : 55 : 1225
    level26.txt : 104 : 1329
    level27.txt : 71 : 1400
    level28.txt : 100 : 1500
    level29.txt : 104 : 1604
    level30.txt : 114 : 1718
    level31.txt : 91 : 1809
    level32.txt : 129 : 1938
    level33.txt : 65 : 2003

    Counts for best solution I’ve seen posted (excluding block switches)
    level 1 : 7 : 7
    level 2 : 19 : 26
    level 3 : 19 : 45
    level 4 : 28 : 73
    level 5 : 33 : 106
    level 6 : 40 : 146
    level 7 : 44 : 190
    level 8 : 12 : 202
    level 9 : 24 : 226
    level 10 : 59 : 285
    level 11 : 49 : 334
    level 12 : 83 : 417
    level 13 : 51 : 468
    level 14 : 71 : 539
    level 15 : 62 : 601
    level 16 : 42 : 643
    level 17 : 114 : 757
    level 18 : 98 : 855
    level 19 : 67 : 922
    level 20 : 61 : 983
    level 21 : 71 : 1054
    level 22 : 109 : 1163
    level 23 : 96 : 1259
    level 24 : 101 : 1360
    level 25 : 55 : 1415
    level 26 : 110 : 1525
    level 27 : 71 : 1596
    level 28 : 100 : 1696
    level 29 : 126 : 1822
    level 30 : 114 : 1936
    level 31 : 127 : 2063
    level 32 : 131 : 2194
    level 33 : 70 : 2264

  4. davbol Says:

    I’m disinclined to post spoilers for anyone who hasn’t completely solved it yet (including your solver program! :D) but I can confirm that there is a legitimate 1999 move 46010 score solution, at least for the version hosted at http://www.miniclip.com/games/bloxorz/en/ that I’m about 99.9% sure is optimal. (though it’s obvious their high-score mechanism has been hacked with some bogus higher scores)

    What I’m not sure about is that some other version of the game might exist where your 2003 is optimal for that version? That is — perhaps some aspect of the puzzles changed between versions? I don’t know, but it’s possible.

    Cheers!

  5. rrabarg Says:

    As you say, high scores are not to be trusted; if is possible to complete in less than 2003 moves, the reason is most likely that the model I have for the game does not 100% match the real game (for example – it could be that I’ve mapped one of the switches incorrectly).

    Unfortunately, the game does not any programmatic interface, and life is too short to spend manually going through the game checking switches and verifying high scores :)

  6. schwanky Says:

    I have found a few shorter solutions to get the grand total to 1999. I deviate from your solutions by the following:

    Level 8 : [R2, D, S, U4, D, R2] : 10 : 193

    Level 15 : [R4, U2, S, U5, R3, U2, R4, D2, S, L4, S, U, D, U, L, U, L3, D, S, L5, D, L2, D3, L, D, R, U, R7] : 57 : 556

    Level 21 : [R, D, L, U, L, D, R, U, R2, U, R3, U, L, D3, U3, R, D, L3, D, L2, D, L, U, R, D, R, U, L, D, R, U, L, D, R, D2, R, D2, R3, U2, D2, L2, U, L, D, R3, U4, R3] : 71 : 969

    I appreciate the time and effort you put into your program! I was stuck at 2020 until I happened upon your weblog. I hope these solutions help you fix your program. :)

  7. rrabarg Says:

    Thanks for the post.

    I’ve verified Level-8, and fixed the bug with that one.

    I’ll have a look at the other 2 in due course.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: