MCB419 logo  




Homework

MCB 419 Homework 5

The first part of the assignment is to construct the NetLogo model described here:
HW05 NetLogo Specifications.
There is no template. You need to write your own NetLogo code, but you can adapt relevant blocks of code from earlier HW assignments. Completing this part will be worth 80% of your hw05 grade.

Once that piece is working properly, the second part of the assignment is to add UFO's that act as 'predators' rather than 'prey' for the rocket. Specifically:

  1. add 5 UFOs with speed controlled by a slider, similar to the rocket slider
  2. the UFOs should use a finite state machine (FSM) to 'hover' for 100 ticks and then 'chase' the rocket for 100 ticks. This is coded for you in the following template: hw05_ufo.nlogo.
  3. When a rocket and ufo collide, the rocket should lose 3 points and the rocket should be repositioned to a safe location located somewhere in the brown region.
  4. Add a switch called 'draw-trails?' and a button called 'clear trails' that control whether or not the rocket leaves a trail on the screen. The draw-trails? switch should function correctly while the simulation is running.
After integrating the UFO's with your simulation, the screen should be similar to the one shown below. Successfully integrating the UFO interactions is worth 10% of the grade.

Finally, the third part of the assignment is to make the rocket 'smarter' so that, in addition to doing taxis towards stars, it also avoids being caught by the UFOs. This part of the assignment is open-ended and counts for up to 10% of the grade. The smarter your implementation the more points you can earn. Some ideas:

  • you might add a pair of UFO sensors, in addition to the light sensors, so the rocket can avoid UFOs
  • you might use a finite-state-machine (FSM) approach to control the rocket's behavior
  • you might have the rocket 'hide' in the brown region where the UFOs can't reach it
  • you can make the task more difficult by increasing the ufo-speed relative to the rocket-speed
  • you can include comments or explanations about your implementation on the INFO tab

Mail your completed netlogo file to mcb419@gmail.com with 'hw05' in the subject line.


Sample solution files:
hw05_sample_solution.nlogo



Mark E. Nelson, University of Illinois at Urbana-Champaign, 2005-2012.