Prequel
primitive recursive driven programming


ConnXxis

(This example requires web workers.)

Touch the top right corner of a tile to rotate it clockwise. Touch the top left to rotate it anticlockwise. Touch the bottom center to swap it with another tile.
Learn about this puzzle in the author's blog.

0 ← score (hi-score: 30)

Shuffle Sync Unsync

Run Pause Stop

0
0
0
← calls
← instructions
← memory (max use: 0)


Prequel program

Edit Save Debug

Module: RANDOM_REPEAT

CONNXXIS.SETUP.ANY()

Input:

CONNXXIS.COUNT.VERTEX
 Total number of different vertexes (tile places) on the board.
 -> 20
 This value is constant; it does not depend on the board setup.
 Note that each vertex is connected to six other vertexes.
 Vertexes on the left connect to those on the right.
 Similarly for bottom and top vertexes, and vice versa.
CONNXXIS.COUNT.TILE
 Total number of tiles.
 -> 20
 This value is constant; it does not depend on the board setup.
 Each tile represents a hexagon.
 In each tile there are six letters in groups of two.
 Three of the six letters are capitals.
CONNXXIS.COUNT.FACE
 Total number of faces in each tile.
 -> 6
 This value is constant; it does not depend on the board setup.
 On each face there is one letter (out of six, possibly capital).
 Face directions:
  -> 0 twelve o'clock
  -> 1 two o'clock
  -> 2 four o'clock
  -> 3 six o'clock
  -> 4 eight o'clock
  -> 5 ten o'clock
CONNXXIS.COUNT.ROTATION
 Total number of rotation states for each tile.
 -> 6
 This value is constant; it does not depend on the board setup.
CONNXXIS.COUNT.EDGE
 Total number of edges (connections) between vertexes.
 -> 60
 This value is constant; it does not depend on the board setup.
edgeIndex = CONNXXIS.VERTEX.FACE.EDGE[vertexIndex][face]
 The edgeIndex that connects vertexIndex through the face direction.
 This value is constant; it does not depend on the board setup.
letterIndex = CONNXXIS.TILE.FACE.LETTER[tileIndex][face]
 The letterIndex that is on the tileIndex face.
 This value is constant; it does not depend on the board setup.
bool = CONNXXIS.TILE.FACE.CAPITAL[tileIndex][face]
 Check whether the tileIndex face corresponds to a capital letter.
 -> 1 if it does
 -> 0 if it does not
 This value is constant; it does not depend on the board setup.
vertexIndex0 = CONNXXIS.EDGE.VERTEX[edgeIndex][0]
vertexIndex1 = CONNXXIS.EDGE.VERTEX[edgeIndex][1]
 The two vertexIndexes connected by edgeIndex.
 This value is constant; it does not depend on the board setup.
otherVertexIndex = CONNXXIS.VERTEX.FACE.VERTEX[vertexIndex][face]
 The otherVertexIndex connected to vertexIndex through the face direction.
 This value is constant; it does not depend on the board setup.
vertexIndex = CONNXXIS.TILE.VERTEX[tileIndex]
 The current vertexIndex (tile place) of tileIndex.
tileIndex = CONNXXIS.VERTEX.TILE[vertexIndex]
 The tileIndex currently at vertexIndex.
rotation = CONNXXIS.TILE.ROTATION[tileIndex]
 The current rotation state of tileIndex.
 Corresponds to how much the tile tileIndex has been rotated.
 -> 0 no rotation
 -> 1 60 degrees clockwise
 -> 2 120 degrees clockwise
 -> 3 180 degrees
 -> 4 240 degrees clockwise
 -> 5 300 degrees clockwise
CONNXXIS.SCORE
 The score of the current board setup.
 It is an integer between 0 and (not higher than) 90.
 The exact highest possible score is currently unknown.
bool = CONNXXIS.EDGE.LETTER[edgeIndex]
 1 iff the vertexes faces connected through edgeIndex have the same letter.
bool = CONNXXIS.EDGE.CAPITAL[edgeIndex]
 1 iff the vertexes faces connected through edgeIndex are both capitals.
vertexScore = CONNXXIS.VERTEX.SCORE[vertexIndex]
 The sum of the scores of all edges of vertexIndex.
CONNXXIS.USER.ID
 Id of the last user modification to the board.
 This number is updated when the user modifies the board setup.
CONNXXIS.USER
 Setup information about the last user modification to the board.
CONNXXIS.HISCORE.INCR.INDEX
 Id of the highest known scores.
 This number is updated if better scores are found.
CONNXXIS.INDEX.SCORE
CONNXXIS.INDEX.VERTEX.TILE
CONNXXIS.INDEX.TILE.ROTATION
 Indexes to retrieve the setup information.
 E.g., the highest known score is:
   hiscoreInfo[CONNXXIS.INDEX.SCORE]
  where
   hiscoreInfo = CONNXXIS.HISCORE(0)
LIMITS.MEMORY
 User defined memory limits (in memory cells/1024).
CALL.ARGS
 Holds the list of arguments passed with CALL.
 -> [arg1, ..., argN]

Procedures:

CONNXXIS.SETUP.ANY()
 Shuffle the tiles.
 Restart program counter.
CONNXXIS.SETUP.TILES(vertexesTileIndexes, tilesRotations)
 Setup the tiles in a specific way.
 -> vertexesTileIndexes: list of tileIndex for each vertexIndex
 -> tilesRotations: list of rotation for each tileIndex
 Restart program counter.
CONNXXIS.ROTATE(tileIndex, rotation)
 Rotate tile tileIndex to rotation.
 -> tileIndex: integer between 0 and CONNXXIS.COUNT.TILE-1
 -> rotation: integer between 0 and CONNXXIS.COUNT.ROTATION-1
 Restart program counter.
CONNXXIS.MOVE(tileIndex, vertexIndex)
 Swap tile tileIndex with tile at vertexIndex.
 -> tileIndex: integer between 0 and CONNXXIS.COUNT.TILE-1
 -> vertexIndex: integer between 0 and CONNXXIS.COUNT.VERTEX-1
 Restart program counter.
CONNXXIS.HISCORE.COUNT(&hiscoreCount)
 How many elements can be retrieved with procedure CONNXXIS.HISCORE.
 -> hiscoreCount: name of variable to hold the result
 Alternative syntax: hiscoreCount = CONNXXIS.HISCORE.COUNT()
CONNXXIS.HISCORE(&hiscoreInfo, elemIndex)
 Setup information about the elemIndex-th highest known score.
 -> hiscoreInfo: name of variable to hold the result
 -> elemIndex: integer between 0 and hiscoreCount-1
 Alternative syntax: hiscoreInfo = CONNXXIS.HISCORE(elemIndex)
CONNXXIS.HISCORE.INCR.COUNT(&hiscoreIncrCount, incrIndex)
 How many elements can be retrieved with procedure CONNXXIS.HISCORE.INCR.
 -> hiscoreIncrCount: name of variable to hold the result
 -> incrIndex: integer between 0 and CONNXXIS.HISCORE.INCR.INDEX
 Alternative syntax: hiscoreIncrCount = CONNXXIS.HISCORE.INCR.COUNT(incrIndex)
CONNXXIS.HISCORE.INCR(&hiscoreIncrInfo, incrIndex, elemIndex)
 Setup information about a known hi-score.
 -> hiscoreIncrInfo: name of variable to hold the result
 -> incrIndex: integer between 0 and CONNXXIS.HISCORE.INCR.INDEX
 -> elemIndex: integer between 0 and hiscoreIncrCount-1
 Alternative syntax: hiscoreIncrInfo = CONNXXIS.HISCORE.INCR(incrIndex, elemIndex)
CONNXXIS.WAIT(seconds)
 Pause execution and resume after seconds seconds.
 -> seconds: number greater than 0
 Restart program counter.
CONNXXIS.HALT()
 Halt the program.
CALL(&retvar1, ..., &retvarM, @modname, arg1, ..., argN)
 Start executing module modname, copying N arguments and expecting M return values.
 -> retvar: name of variable to hold the corresponding return value retval
 -> modname: name of module to start executing
 -> arg: value to be copied to the list CALL.ARGS
 Alternative syntax: retvar1, ..., retvarM = CALL(@modname, arg1, ..., argN)
 Note that recursive module calls are not allowed.
RETURN(retval1, ..., retvalM)
 Return M values from the current module.
 Resume execution at the next instruction of the corresponding CALL.
 -> retval: value to be copied to the corresponding variable retvar

Additional examples can be found on GitHub.