This assignment involves simulating a bush fire situation where a human and robot are trapped and must navigate to exit points to escape the spreading fire. Students must program a system with components like a fire simulator, J2ME client, RMI server, and WAP browser to simulate the fire propagation and movement of the human and robot over multiple turns as they try to reach exit points before being engulfed by the fire. The student must submit all Java code implemented for the fire simulator, servers, clients, and other components.
1. Assignment 3
2009 Session 2
Theme: Wireless Programming
Released Mon 14 Sept 2009
Due Fri 02 Oct 2009
Marks 20
Scenario: In this assignment we consider situation management applications in a bush
fire scenario. In a bush fire situation, a human and a robot are trapped in a bush
fire, see Fig 1, where H is the human and R is the robot. The squares labelled
E(green) denote exit points, and F(red) denote fire. Exit points are used by H and R
for escape. As fire spreads, the red squares shift to any one of their
neighbouring squares randomly. If fire enters any exit point, that exit point cannot
be used for escape until the fire moves out of the exit point to some other adjoining
squares. The human and the robot try to escape from the fire world by navigating to
the exit points which are not on fire. During the course of their movement, if they
touch fire (that is, found themselves in the square which is red), they die. (This can
happen if the human/robot moves to a square to which the fire also has moved at the
same time.)
F E
H
E F E
R
F
Figure 1 Fire world – a two dimensional array of size 10 x 10: Fire (F), Human(H),
Robot( R ), and Exit(E)
2. Programming
We simulate the world containing fire, human, and robot using the system shown in
Fig 2.
Tomcat
IE or FireFox Browser
RMI server
RMI object:
Rob J2ME wireless tool kit(used
servlets by human H)
RMI client
WAP Browser(used by robot
R)
MySQL
Fire
Simulator
Figure 2 Fire situation management framework
The system consists of a fire simulator to simulate fire propagation, an intelligent
J2ME client (for H), a WAP browser (for R), an RMI object Rob to simulate the
behaviour of R, tomcat to support the overall service, the IE/FireFox browser, and a
MySQL database. The function of each component is described below.
Fire simulator It simulates fire, and periodically updates the MySQL database.(You
can choose your own period of updation.) That is, it takes each red (F) square, makes
it white ( it is not on fire anymore), randomly selects one of its eight adjoining
squares, and makes it red. This has the effect of fire spreading randomly. Note that
the number of adjoining squares will be less when you consider fire at the
boundaries of the world.
J2ME client It obtains the locations of F,R,E, and H from the MySQL database
using the servlets, and moves H in an appropriate direction by one square
(up/down/left/right) in an attempt to go towards a convenient exit point. It also sends
a command to the RMI object Rob (using the services of the servlets) to move Rob
up/down/left/right so that Rob can also get closer to its own safe exit point. You can
choose these safe exit points appropriately (using your own criteria) as fire spreads.
Additionally, J2ME client should display on its screen the exit point selected for H,
the exit point selected for Rob, and the command sent to Rob.
RMI object Rob It responds to J2ME’s commands. That is, it moves
up/down/left/right by one square, and stores its current position in its memory. Note
3. that the world is a two dimensional array, so you can specify Rob’s position by a row
and column <i,j>.
The WAP Browser It requests the servlets to send Rob’s current position, and
displays it on its screen (whenever a RELOAD button in the WAP is pressed). Note:
You need to provide this reload button in the WAP client.
IE/Fire Fox Browser It displays the entire world which is a two dimensional array
with fire, exit, H, and R, whenever its RELOAD button is pressed.
Implement this system using the components mentioned in the figures above. To
implement this, you can use the latest Tomcat, MySQL, J2ME wireless tool kit, any
WAP browser, and Java 1.6. You can either invoke them directly on the command
lines individually(which is what I have done), or (less painfully) install them on an
IDE (such as Eclipse or Netbeans), and run them.
Use sample servlet and midlet codes discussed in the class (see CODE link on the
homepage). Feel free to write your own code, if you do not want to use them.
Submission: Submit all Java code your wrote: Fire simulator, RMI server, all
servlets, and all midlets.
% give cs9031 ass3 Ass3.jar
Marking is done by taking demos from you after the submission deadline. Demo
schedule will be released in due course.
I am sure, you will have lots of questions to ask – please post them in the Ass3 thread.
GOOD LUCK!
============ end of Assignment 3 description ============