primitive recursive driven programming
(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
Runtime Error: DIVISION BY ZERO
←0 ← calls
← memory (max use: 0)
Edit Save Debug
Parser Error: UNEXPECTED CHAR
CONNXXIS.COUNT.VERTEXTotal number of different vertexes (tile places) on the board.-> 20This 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.TILETotal number of tiles.-> 20This 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.FACETotal number of faces in each tile.-> 6This 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'clockCONNXXIS.COUNT.ROTATIONTotal number of rotation states for each tile.-> 6This value is constant; it does not depend on the board setup.CONNXXIS.COUNT.EDGETotal number of edges (connections) between vertexes.-> 60This 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 notThis value is constant; it does not depend on the board setup.vertexIndex0 := CONNXXIS.EDGE.VERTEX[edgeIndex]vertexIndex1 := CONNXXIS.EDGE.VERTEX[edgeIndex]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 clockwiseCONNXXIS.SCOREThe 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.IDId of the last user modification to the board.This integer is updated when the user modifies the board setup.CONNXXIS.USERSetup information about the last user modification to the board.CONNXXIS.HISCORE.INCR.INDEXId of the highest known scores.This integer is updated if better scores are found.CONNXXIS.INDEX.SCORECONNXXIS.INDEX.VERTEX.TILECONNXXIS.INDEX.TILE.ROTATIONIndexes to retrieve the setup information.E.g., the highest known score is:hiscoreInfo[CONNXXIS.INDEX.SCORE]wherehiscoreInfo := CONNXXIS.HISCORE(0)LIMITS.MEMORYUser defined memory limits.MODULE.CALL.ARGSHolds the list of arguments passed with MODULE.CALL.-> [arg1, ..., argN]
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 tileIndexRestart 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-1Restart 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-1Restart program counter.CONNXXIS.HISCORE.COUNT(&hiscoreCount)How many elements can be retrieved with procedure CONNXXIS.HISCORE.-> hiscoreCount: name of variable to hold the resultAlternative 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-1Alternative 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.INDEXAlternative 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-1Alternative syntax: hiscoreIncrInfo := CONNXXIS.HISCORE.INCR(incrIndex, elemIndex)CONNXXIS.WAIT(seconds)Pause execution and resume after seconds seconds.-> seconds: integer greater than 0Restart program counter.CONNXXIS.HALT()Halt the program.MODULE.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 MODULE.CALL.ARGSAlternative syntax: retvar1, ..., retvarM := MODULE.CALL(@modname, arg1, ..., argN)Note that recursive module calls are not allowed.MODULE.RETURN(retval1, ..., retvalM)Return M values from the current module.Resume execution at the next instruction of the corresponding MODULE.CALL.-> retval: value to be copied to the corresponding variable retvar
Additional examples can be found on GitHub.