Skip to content

Instantly share code, notes, and snippets.

@Artanis
Last active March 4, 2020 01:12
Show Gist options
  • Save Artanis/6961242 to your computer and use it in GitHub Desktop.
Save Artanis/6961242 to your computer and use it in GitHub Desktop.
Hacking around in Entanglement for fun. Quick function that replaces all the randomized tiles with one provided by the player.
// Run this in the JavaScript console of the Entanglement game.
// Code targets Entanglement on 2013-10-13
// http://entanglement.gopherwoodstudios.com
//
// Replays of games using this will be horribly broken
/* Replaces all possible tiles with the given tile.
*
* Cannot replace the first tile, nor the first swap tile.
*
* Tiles are defined by a 12-element array of integers 0 through 11.
* The array index is unimportant.
*
* For the purposes of this explanation, a port is where a line crosses
* into another tile, and a connection is where one port on a tile
* connects to another port on the same tile.
*
* Ports are numbered 0 through 11. In the initial tile rotation, port 0
* is the top edge, left port. Port 1 is immediately clockwise (top
* edge, right port). Further ports are numbered clockwise, with port 11
* being to the immediate left of port 0.
* Each pair of integers form a connection. For example, the simple tile
* ``[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]`` describes a tile of
* u-turns (each port forms a connection with the other port on the same
* edge). The tile ``[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0]`` describes
* a tile of sharp turns (each port forms a connection with the adjacent
* port of the nearest edge).
*
*/
var entanglement_set_next_tile = function (tile) {
for(var i = 0; i < gws.currentGame.tiles.length; i++) {
gws.currentGame.tiles[i] = tile;
}
}
var entanglement_set_current_tile = function(tile) {
// I don't know how to do this, but I want to.
// This would be better than replacing all the random tiles.
}
@Figgy24-20
Copy link

I'm trying to get this to work, but it isn't. Can you help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment