The LinkUp Game in JavaFX

Posted: under linkup.
Tags: , ,

You may have remembered that I introduced a JavaFX implementation of the Frozen Bubble game by Liu Xuan. He finished another JavaFX game, LinkUp, recently. This is a game of fun, especially for kids, and had been implemented in many languages, such as flash and java. It is simple to play the game: look for two identical images and eliminate them. There must be a path connecting the two images and the path must have no more than two turns.


Like in any games, visual effect and algorithms are two key elements. In this game, most of the visual effects can be easily achieved by JavaFX API(like fade in/out, animation). According to Liu, the algorithm to find two conntected cells are the hightlight of the game. A breadth-first search algorithm is used to find the shortest path. Check the code at Model.fx, there are three functions: findNoCross(),
findOneCross() and findTwoCross() implemented for this purpose. The first function finds a set of cells that can be reached by a line(directly). If the target cell is not in this set, the second function is invoked to look for cells reachable by a turn. Similarly, the third function is used for searching a path of two turns.


If you are interested in the details of the game, come take a look at the code (Note: Liu Xuan has the copyright of the source code). Or, you can just enjoy playing this game by clicking the below image:


click to start LinkUP game

click to start LinkUP Game

Comments (1) Jun 01 2009