SourceForge > Anagrams |
|
Brought to you by
|
This project is an interactive multi-player web game based on the Victorian Anagrams game.
Anagrams - The Word Game
Anagrams was published by Selchow & Righter, Embossing Company, and Oxford Games (and probably
other companies). There is no standard set of rules, although all versions share some common
features:
- a set of tiles, each with a letter on one side
- players form words from the letters
- players steal words by rearranging the letters
The rules I chose to implement aren't taken from any of the published games; they are the rules my
family plays by.
Implementation - Java & JavaScript
Anagrams is implemented as a Java servlet. Rather than generating HTML on the server, we use
JavaScript on the browser to request updates via XmlHttpRequest. The response is a sequence of
JavaScript functions to execute which will bring the DOM up to date with the latest changes to the
game state made by all the players. This approach reduces the bandwidth required for an interactive
game. If there haven't been any changes, the server waits up to 25 seconds before responding. If
changes to the game state occur during this period, the server replies immediately. This
effectively inverts the control, allowing the server to send changes to the browsers.
Both the Java and JavaScript side include unit tests.
The project was implemented using IDEA, but Ant tasks are provided for building the application and
running the Java tests. The JavaScript tests can be run once the application is deployed.
Links
Screenshot
- Danny Epstein