Liu Xuan has developed another JavaFX game, LinkUp . This is a game of fun, especially for kids, and had been implemented in many languages and platform, 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.