A maze-like puzzle for two parties, with some unexpected twists. For 15-112.
Built on node.js, express, and socket.io. Why express? Why not?
npm install
node server.js
Before you do anything, register yourself.
Send the register
event to register yourself to the server. If successful, you'll receive the puzzleUpdate
event.
Parameters:
false
, the server assumes you're the observer.Send the move
event when you wish to move the player. You must be registered first. All move
events received from the observer will be ignored. If successful, both the player and observer will receive the puzzleUpdate
event.
Parameters:
["L", "R", "U", "D"]
. Other values will be ignored. Should be pretty self-explanatory.Send the hint
event when you wish to send coordinates of a spot on the board where the player should go (of course, the server may intercept and modify your hint along the way). All hint
events from the player will be ignored. If successful, both the player and observer will receive the puzzleUpdate
event.
Parameters:
The puzzleError
message is sent when...you cause an error. You can do what you like with the message.
Parameters:
The puzzleUpdate
message is sent whenever the puzzle state has changed, or whenever the server feels like it. It's best not to wonder why and to just draw the puzzle.
Parameters:
Field | Type | Description |
---|---|---|
playerSym | string | the character used to denote the player's position in the puzzle |
targetSym | string | the character used to denote the position in the puzzle the player is trying to get to |
obstacleSym | string | the character used to denote an obstacle in the puzzle |
emptySym | string | the character used to denote an empty space in the puzzle |
level | number | the level number of the puzzle |
state | string | one of "normal", "reset", or "newLevel". describes the sent puzzle |