Java case studies: game playing - PowerPoint PPT Presentation

About This Presentation
Title:

Java case studies: game playing

Description:

Java case studies: game playing A simple software development process from specification, to design, implementation, and test – PowerPoint PPT presentation

Number of Views:129
Avg rating:3.0/5.0
Slides: 23
Provided by: bot95
Category:
Tags: case | design | game | java | playing | studies | test

less

Transcript and Presenter's Notes

Title: Java case studies: game playing


1
Java case studies game playing
  • A simple software development process from
    specification, to design, implementation, and test

2
Points of this development Java sample game
  • Create a simple game by using Java

Demonstrate the importance of software
engineering principles for simple Java programs
development
Illustrate a methodology how to develop a Java-
applet step by step.
Inspired by the lecture K. Bothe Mouse in a
Maze
Using Java API
3
Course materials
  • Lecture slides
  • about 20 slides
  • takes 2 lecture hours (to complete the whole
    process)
  • Assignments
  • modify presented program
  • make new games using presented example.



4
Global description of the task Lost cat
  • Task
  • Develop a program, to simulate the finding of a
    lost cat by using information closer-further.

5
Facts concerning software development phases
  • Most errors of software systems result from
    misunderstanding the problem to be solved.
  • Software development consists only of a small
    part of programming
  • Requirements analysis 20
  • Design 15
  • Implementation 20
  • Test 45

6
Learning goals
  • This example should illustrate the importance of
    a complete and correct requirements specification
    for the project success.
  • Before implementing, try to apply all previous
    phases in SW development.
  • Start with the implementation when all classes
    and methods are known.

7
Development process of Lost cat
  • Requirements analysis
  • Design
  • Implementation and test

8
Requirements analysis Lost cat
  • Task
  • Develop an applet (using GUI), to simulate the
    searching a lost cat. The position of cat is
    randomly chosen. The searching is simulated by
    mouse-clicks.

9
Open questions
  • How to mark a visited position?
  • How to keep the visited positions?
  • How to present information you are closer
    (further) to the cat?
  • When the cat is found?
  • What will happen when the cat is found?
  • What is the environment where we look for?

10
Requirements specification (1,2)
  • We point out the position of a lost cat by
    mouse-click in current position of the mouse
    pointer. We will mark the chosen position in some
    way. The different kinds of flags, can be used,
    but we decide to use the simplest one the
    filled circle.

visited position
We will keep the visited positions in an array.
(Data structures like vectors, linked lists,
could be used too.) By using this array we will
draw the circles.
11
Requirements Specification (3)
  • We will use two ways to inform the player about
    position of the cat
  • by text-messages
  • by flags (circles)
  • The different colors of flags determine
    whether the chosen position is closer or further
    (related to previous position) from the cat.
  • The following colors are used

start position
closer
further
found cat
12
Requirements Specification (4,5)
  • If the point (xc, yc) is position of the cat and
    (x,y) position of the mouse pointer, we will
    suppose that the cat is found if
  • (xc-xlt10)
  • (yc-ylt10)
  • (We may measure the distance on some other
    way.)
  • When the cat is found, the picture of the
    cat will fill the window of applet. The follow
    picture is used

13
Requirements Specification (6)
  • We can use any color for the background of our
    applet. Moreover, it is more convenient to
    simulate nature environment in some way. We
    deside to use the following picture to simulate
    the nature environment

14
Development process of Lost cat
  • Requirements analysis
  • Design
  • Implementation and test

15
Design develop the software architecture
  • SW architecture description languages UML-
    industry standard.
  • Main problem How to find classes?
  • Finding a proper class structure may be more
    challenging then implementing the Java program
    code (K. Bothe).

16
Software architecture
  • Our task is not so complicated (it is a simple
    students assignment!) Thus, the structure of our
    program should not be complicated. Moreover, we
    have to define
  • Which components exist?
  • Which relations are between them?
  • We will have a main class (CatGame) and an
    auxiliary class (Mouse)

17
UML diagram
18
The main class
  • CatGame
  • . . .
  • init()
  • addCircle()
  • update(Graphics g )
  • paint(Graphics g)

19
Development process of Mouse in a Maze
  • Requirements analysis
  • Design
  • Implementation and test

20
Implementation phase
  • We use 3 steps in the implementation (In fact 3
    applets are developed. Each applet is
    independently tested)
  • Circle
  • Circles
  • CatGame

21
Testing
  • The applets Circle and Circles are very simple
    for the testing.
  • The applet CatGame is more complicated. We should
    complete game to see the picture of the cat.
  • We should to adjust all parameters to fit
    everything in the window of applet

Demonstration
22
Critics of the implementation
  • The structure of classes should be better
    organized.
  • UML diagrams could be presented with more
    details.
  • Program should be more secure (the private
    variable should be used)
  • . . .
Write a Comment
User Comments (0)
About PowerShow.com