Let's perfect our skills by implementing a game that allows players to use JavaScript. The rules are simple. Each player has a number of entities that move on the board. All entities move in turns; during each turn, the entity can stand still or move to an adjacent tile (cardinally or diagonally). If an entity moves to the tile occupied by another entity, that entity is killed and removed from the board.
At the beginning of the game, all entities are placed randomly on the board. An example of a starting position is displayed on the following image:
Each player must provide a JavaScript function that receives an entity object and returns its new position. This function will be called when one of the player's entities should move. Additionally, the player may provide an initialization function that will be called at the beginning...