Transcript slides 10
Object
Oriented
Design
Goals
Pacman
Project Reflections
The Sims Project: additional pointers
Classes
Pacman
Ghost
Dot
Power
Maze
Fruit
Score
pill
On state diagrams
Naming
of states: much better!
Transitions
Need
labels!
Labels = Event [Guard] / Action
If multiple objects are involved: event needs to
describe
who
is involved
what happens to whom
Describe Event not Method
Ghost states:
attacking
eat
fleeing
Not clear
who is
involved
Ghost state diagram
attacking
Power Pill effect is gone (2 secs)
Ghost reaches home
Pacman eats power pill
Returning to
ghost home
fleeing
blinking
Power Pill effect fades away (10 secs)
fleeing
Sequence diagrams
Keep
general flow left to right
What
:Pacman
makes the ghost go right?
:Ghost
kill
Ok, but not
recommended
:Ghost
:Pacman
kill
Good
The Sims
Collaborative Diffusion
Search
Can
be used to build simulations including
object interactions even more complex than
that found in the Sims
Getting started
Look
at existing AgentSheets projects
“Ultimate
Pacman”
“World Cup”
Diffusion Difference
Equations
Simple
u
(k=0.25)
:= 0.25 * (u[left] + u[right] + u[up] + u[down])
General
u := @k * (u[left] + u[right] + u[up] + u[down] - 4 * u) + u
Where k is
The diffusion coefficient
Should be < 0.45
Debugging diffusion
3D
Plot is only available in research
prototype
Use colorization
Wanted
We
need one person who would help
building an infrastructure (counts as final
project).
Who knows
Java
and OpenGL
Java
OpenGL