Robot Factory Game (JavaFX)

Your task is to layout conveyor tracks and switches for a factory that makes toy robots. Robots emerge from a source tunnel carrying a tape with red and blue marks. They follow your conveyors until they reach a switch, where the next mark is red from the tape. The robot then moves in one of three directions depending on whether that mark is red, blue, or the tape has reached the end. Robots should be accepted or rejected according to the goal statement in a challenge file, which specifies the conditions under which the tapes are acceptable. The challenge file also contains a regular expression that formally describes the goal. A robot is rejected by directing it onto any blank cell, and accepted by routing it to an exit tunnel.

Your solution is tested when you press the Play button (or select Go on the Game menu). If it is incorrect, an example tape for which your solution produces the wrong outcome will be presented along with an animation of that robot. Note that a wrong outcome could be either an incorrect acceptance or an incorrect rejection of a robot.

If your solution is correct, you will be offered an opportunity to see an animation of a random test case. A correct solution is not necessarily a minimal solution. You can check whether your solution is minimal by selecting File->Print DFA. That will show you a state transition table extracted from your solution along with a note as to any switch pairs that are redundant. These will be indicated by their location on the playfield.

This is an executable jar file, so you need to install the Oracle Java 8 runtime. PLEASE NOTE: This will NOT run under Java 10. I will post an update as soon as I can get to it.

Executable jar Example Challenges and Solutions (Last upload on Mar 13, 2017)

Notes for Students

If you're looking for an example solution to a similar JavaFX course project, go HERE. That assignment is a simpler version that verifies the player's solution with a static set of test tapes. It is not possible, however, to catch all possible incorrect solutions with a static set of test cases. Not for an arbitrarily large playfield anyway.

The game you find here doesn't suffer from that shortcoming. Instead, it walks the player's solution, turning it into an internal representation of a Discrete Finite Automata (DFA). It then computes the difference between that DFA and the known correct DFA, as specified by the regular expression in the Challenge file. If there is a difference, it is able to immediately generate a test tape that will break the player's solution (yes, it does this without searching internally through a bunch of test cases). It also detects whether the player's solution has any redundant states, and says where they can be found on the playfield (in terms of switch locations).

You may not have encountered DFAs, except in the form of Regular Expressions, because our degree program no longer requires that you take an Automata course. When a DFA is enhanced with the ability to move backwards and forwards over the tape and overwrite the input symbols with output symbols it is called a standard Turing machine, which provides an important theoretical model for what it means to “compute.” If we were to enhance this game with those abilities (which wouldn't be that hard), challenges could take the form of things like “count the red dots at the beginning of the tape, and the blue dots that follow, and write the difference after the blue dots, in red.”