Design task: Pacman. Software engineering Szoftvertechnológia. Dr. Balázs Simon BME, IIT

Similar documents
Project 2: Searching and Learning in Pac-Man

ADVANCED TOOLS AND TECHNIQUES: PAC-MAN GAME

Project NMCGJ : Pac-Man Game

All theory, no practice

CS188: Artificial Intelligence, Fall 2011 Written 2: Games and MDP s

Clever Pac-man. Sistemi Intelligenti Reinforcement Learning: Fuzzy Reinforcement Learning

Creating PacMan With AgentCubes Online

Creating PacMan With AgentCubes Online

Inaction breeds doubt and fear. Action breeds confidence and courage. If you want to conquer fear, do not sit home and think about it.

CS7032: AI & Agents: Ms Pac-Man vs Ghost League - AI controller project

In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

Discussion of Emergent Strategy

CMSC 372: Artificial Intelligence Lab#1: Designing Pac-Man Agents

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Artificial Intelligence for Games. Santa Clara University, 2012

An Approach to Maze Generation AI, and Pathfinding in a Simple Horror Game

Clone Wars. Introduction. Scratch. In this project you ll learn how to create a game in which you have to save the Earth from space monsters.

Ada Lovelace Computing Level 3 Scratch Project ROAD RACER

MULTI AGENT SYSTEM WITH ARTIFICIAL INTELLIGENCE

Module 1 Introducing Kodu Basics

The Kapman Handbook. Thomas Gallinari

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

A Model-based Approach to Optimizing Ms. Pac-Man Game Strategies in Real Time

Developing Frogger Player Intelligence Using NEAT and a Score Driven Fitness Function

Cassie Huang and Michael D Ambrosio Introductory Digital Systems Laboratory December 14, 2005

CSSE220 BomberMan programming assignment Team Project

Subway simulator Case study

The Game Development Process

CS 354R: Computer Game Technology

Master Thesis. Enhancing Monte Carlo Tree Search by Using Deep Learning Techniques in Video Games

Whack-a-Witch. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Grade 6 Math Circles Combinatorial Games November 3/4, 2015

Artificial Intelligence. Cameron Jett, William Kentris, Arthur Mo, Juan Roman

UML Use Case Diagrams

When placed on Towers, Player Marker L-Hexes show ownership of that Tower and indicate the Level of that Tower. At Level 1, orient the L-Hex

Course Outline Department of Computing Science Faculty of Science

Accidental Adventure Assembly and Rules of Play

Ovals and Diamonds and Squiggles, Oh My! (The Game of SET)

Mittwoch, 14. September The Pelita contest (a brief introduction)

Ghostbusters. Level. Introduction:

Object-Oriented Design

Lab 4 VGA Display MINI-PACMAN

zogar s gaze Objective

Artificial Intelligence

What is a Game? See also references at end of slides (if any)

Population Dynamics: Predator/Prey Student Version

CSE 473 Midterm Exam Feb 8, 2018

Capturing and Adapting Traces for Character Control in Computer Role Playing Games

Creating Journey With AgentCubes Online

SOFT 437. Software Performance Analysis. What is UML? UML Tutorial

VACUUM MARAUDERS V1.0

by Dario Dordoni The toilet isn't always right behind the corner: sometimes finding it is a quest in itself!

Getting Started with Osmo Coding. Updated

122 Taking Shape: Activities to Develop Geometric and Spatial Thinking, Grades K 2 P

GAME PROGRAMMING & DESIGN LAB 1 Egg Catcher - a simple SCRATCH game

The Sweet Learning Computer

Assessment. Self Assessment. Teacher Assessment. Date Learning Objective(s) Achievement or. NC Level: Game Control Student Booklet P a g e 1

Mutiny Anyone? Counters. Objective. Setup. Order of Play. Card Types. Victory

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

Pac-Man EXTREME!!!!! Kim Dauber and Rachael Devlin Fall 2017

Using the Two-Way X-10 Modules with HomeVision

CHASE THE FLUSH. Ante wager-- means a wager required by the game to initiate the start to the round of play.

*EABA is our quite serious rpg system and well worth your time to take a look at... 4

Playing By Order of the Queen:

Bouncy Dice Explosion

Analyzing Games.

Unit 1 - Surveying the Landscape

Little Dead Riding Hood

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

Tutorial: Creating maze games

CSci 1113, Spring 2018 Lab Exercise 13 (Week 14): Graphics part 2

Computer Science. Using neural networks and genetic algorithms in a Pac-man game

Scheme of Work Overview

Blackjack for Dummies CSE 212 Final Project James Fitzgerald and Eleazar Fernando

HEY! DON T READ THESE RULES!

Towards Modeling of Data in UML Activities with the SPACE Method

Towards Integrated System and Software Modeling for Embedded Systems

1. Layout all 20 cards face down in 4 rows of This game is played just like Memory or

Free Cell Solver. Copyright 2001 Kevin Atkinson Shari Holstege December 11, 2001

Introduction. How to Win

HUJI AI Course 2012/2013. Bomberman. Eli Karasik, Arthur Hemed

ZOO SAMPLE CARTRIDGE PLAYER

Turn over 1 corner sea hex and place the Horseman (robber) there. Remove the Soldier and Monopoly Development Cards and set them aside.

Adversarial Search. Human-aware Robotics. 2018/01/25 Chapter 5 in R&N 3rd Ø Announcement: Slides for this lecture are here:

MATHEMATICAL RELATIONAL SKILLS AND COUNTING

Looking for the Franklin Expedition

Looking for the Franklin Expedition

Intro to Digital Logic, Lab 8 Final Project. Lab Objectives

FULL RULEBOOK GAME FLOW TABLE OF CONTENTS. Playing Scenarios... 17

CS1802 Week 9: Probability, Expectation, Entropy

UMLEmb: UML for Embedded Systems. II. Modeling in SysML. Eurecom

Getting Started with Coding Awbie. Updated

Vectrex Dark Tower. The games are as follows: Skill Level Keys Provided. Vectrex Dark Tower

Contents. Important Terms. Components. Credits

Learning Artificial Intelligence in Large-Scale Video Games

Hierarchical Controller for Robotic Soccer

Introduction. Contents

Game AI Overview. What is Ar3ficial Intelligence. AI in Games. AI in Game. Scripted AI. Introduc3on

30-45 Mins Ages Players BY JEREMY KALGREEN AND CHRIS VOLPE RULEBOOK

IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES 1

Transcription:

Design task: Pacman Software engineering Szoftvertechnológia Dr. Balázs Simon BME, IIT

Outline CRC cards Requirements for Pacman CRC cards for Pacman Class diagram Dr. Balázs Simon, BME, IIT 2

CRC cards Dr. Balázs Simon, BME, IIT 3

What is an object? It is a service provider It should have a limited number of provided services (responsibilities) It has a hidden internal state The provided services should be closely related to each other and to the inner state It is collaborating with other objects by using their services Dr. Balázs Simon, BME, IIT 4

How to decompose the problem domain into objects? Find the nouns in the problem description (use cases, user stories, requirements) Identify the ones within the problem domain and the ones outside the system boundary The system boundary is usually at the user interaction and at the communication with external systems The nouns within the problem domain are the most important objects Dr. Balázs Simon, BME, IIT 5

How to decompose the problem domain into objects? Find the responsibilities of each identified object Find the collaborators of each object, that is, other objects whose services the object uses Decompose the objects into simpler objects until they are small enough, self-consistent and self-contained Follow the problem domain whenever possible Make up other objects and agents, if they simplify things Do not deal with internal state at this point Dr. Balázs Simon, BME, IIT 6

How to create classes from the objects? The objects of the problem domain will become classes The provided services (responsibilities) will become methods The collaborators will appear in relationships (uses, association, containment, inheritance) Dr. Balázs Simon, BME, IIT 7

Consistent method for problem decomposition CRC cards: Class-Responsibilities-Collaborators physical paper cards (3x5 inches, 10x15 cm) could be supported by a software tool informal language in the problem domain Example: Card deck class Holds cards Shuffles deck Card Table Delivers cards one at a time responsibilities collaborators Dr. Balázs Simon, BME, IIT 8

CRC cards Informal uses the language of the problem domain can be discussed with the customer non-technical: no programming language constructs, no types, no methods Physical record of design decisions Dr. Balázs Simon, BME, IIT 9

Design process Create a card for each identified object in the problem domain Use the name of the object as the class name Store the cards in alphabetical order Start writing responsibilities if you already know some of them Go through the scenarios (use cases, user stories) and identify who is responsible for what Dr. Balázs Simon, BME, IIT 10

Design process: going through a scenario Find the initial object Write down its responsibility for the initiation of the scenario if it is not yet written Find the objects it has to interact with Iterate: write down their responsibilities and find their collaborators in the scenario, etc. You can physically put the next card on a table or put it back if it is no longer part of the scenario Add abstract objects and agents if necessary Dr. Balázs Simon, BME, IIT 11

From CRC cards to UML Create classes from the CRC cards Create methods from the responsibilities Create relationships (uses, association, containment, inheritance) with the collaborators inheritance: is the object a kind of another? should they have a common ancestor? containment: is the object a part of another? association: does the relationship survive method calls? uses: does the relationship last for a single method call? Add attributes for the inner state Refine the model to follow the OO patterns, principles, guidelines and heuristics Draw sequence diagrams for the scenarios (use cases, user stories) Dr. Balázs Simon, BME, IIT 12

Requirements: Pacman Dr. Balázs Simon, BME, IIT 13

Informal requirements I. The player controls Pac-Man through a maze, eating pacdots (also called pellets). Pac-Man gets 20 points for eating a pac-dot. When all pac-dots are eaten, Pac-Man is taken to the next stage. Four enemies (Blinky (red), Pinky (pink), Inky (blue) and Clyde (orange)) roam the maze, trying to catch Pac-Man. Pac-Man is faster than the monsters, but if an enemy touches Pac-Man, a life is lost and the Pac-Man dies. When all lives have been lost, the game ends. Dr. Balázs Simon, BME, IIT 14

Informal requirements II. Sometimes larger dots known as power pellets appear randomly in the maze for a limited time. The power pellets have many kinds and they give Pac-Man some abilities. The life pellet gives Pac-Man a new life, but the maximum number of lives is five. If the maximum number is reached and Pac-Man collects a life pellet, the pellet disappears without any effect. Pac-Man can also collect bomb pellets, at most five of them. If the maximum number is reached, Pac-Man cannot collect any more, and the pellets remain in the maze. Pac-Man can place the collected bombs in the maze. The bombs have a timer ticking backwards. If the time is expired, the bomb vanishes. If anyone (Pac-Man or a monster) touches the bomb before the time is expired, he dies. Collecting the bonus pellet gives 1000 points to Pac-Man. Dr. Balázs Simon, BME, IIT 15

Informal requirements III. Monsters cannot pick up pellets. However, they apply different strategies for catching Pac-Man. Blinky always follows Pac-Man through the path Pac-Man used. Pinky goes toward Pac-Man on the shortest path. Inky is stupid and only wanders randomly. Clyde is a bit cleverer. He also wanders randomly, but when Pac-Man is near (within five steps), he starts chasing him using the shortest path. Dr. Balázs Simon, BME, IIT 16

Formal requirements I. Identifier R01 R02 R03 R04 R05 R06 R07 R08 R09 R10 R11 R12 Requirement The player controls Pac-Man through a maze. Pac-Man eats pac-dots (also called pellets). Pac-Man gets 20 points for eating a pac-dot. When all pac-dots are eaten, Pac-Man is taken to the next stage. Four enemies (Blinky (red), Pinky (pink), Inky (blue) and Clyde (orange)) roam the maze. The enemies are trying to catch Pac-Man. Pac-Man is faster than the monsters. If an enemy touches Pac-Man, a life is lost and the Pac-Man dies. When all lives have been lost, the game ends. Sometimes larger dots known as power pellets appear randomly in the maze for a limited time. The power pellets have many kinds. The power pellets give Pac-Man abilities. Dr. Balázs Simon, BME, IIT 17

Formal requirements II. Identifier R13 R14 R15 R16 R17 R18 R19 R20 R21 R22 R23 Requirement The life pellet gives Pac-Man a new life. The maximum number of lives is five. If the maximum life number is reached and Pac-Man collects a life pellet, the pellet disappears without any effect. Pac-Man can collect bomb pellets. Pac-Man can collect at most five bomb pellets. If the maximum number of bomb pellets is reached, Pac-Man cannot collect any more, and the pellets remain in the maze. Pac-Man can place the collected bombs in the maze. The bombs have a timer ticking backwards. If the bomb s timer is expired, the bomb vanishes. If anyone (Pac-Man or a monster) touches the bomb before the time is expired, he dies. Collecting the bonus pellet gives 1000 points to Pac-Man. Dr. Balázs Simon, BME, IIT 18

Formal requirements III. Identifier R24 R25 R26 R27 R28 R29 Requirement Monsters cannot pick up pellets. Monsters apply different strategies for catching Pac-Man. Blinky always follows Pac-Man through the path Pac-Man used. Pinky goes toward Pac-Man on the shortest path. Inky is stupid and only wanders randomly. Clyde is a bit cleverer. He also wanders randomly, but when Pac-Man is near (within five steps), he starts chasing him using the shortest path. Dr. Balázs Simon, BME, IIT 19

CRC cards for Pacman Dr. Balázs Simon, BME, IIT 20

Entities Potential entities (nouns): Player, Pacman, Maze, Pac-Dot,, Point, Stage, Enemy, Blinky, Pinky, Inky, Clyde, Life, Game, Dot, Large dot, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Step Additional artificial entities: : a cell of the maze Synonyms: Player = Pacman Dot = Pac-Dot = Large dot = Power pellet Enemy = Monster Stage = Maze Step = Final list of potential entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 21

Entities Final list of potential entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Kind-of relationships: Monsters: Blinky, Pinky, Inky, Clyde : Power pellet Power pellet: Life pellet, Bomb pellet, Bonus pellet Abilities: Life, Bomb, Point Dr. Balázs Simon, BME, IIT 22

R01. The player controls Pac-Man through a maze. Responsibility: move up, down, left or right Move up, down, left or right Pacman Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 23

R02. Pac-Man eats pac-dots (also called pellets). Responsibility: eat pellet Move up, down, left or right Pacman Eat Pacman Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 24

R03. Pac-Man gets 20 points for eating a pac-dot. Responsibility: add points Move up, down, left or right Add points Pacman Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 25

R04. When all pac-dots are eaten, Pac-Man is taken to the next stage. Responsibility: go to next stage/maze remove pellet Go to next maze Game Maze Remove pellet Maze Eat Pacman, Maze Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 26

R05. Four enemies (Blinky (red), Pinky (pink), Inky (blue) and Clyde (orange)) roam the maze. Responsibility: move up, down, left or right Move up, down, left or right Monster Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 27

R06. The enemies are trying to catch Pac-Man. Responsibility: catch Pac-Man Move up, down, left or right Add points Catch Pacman Monster Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 28

R07. Pac-Man is faster than the monsters. Responsibility: Pac-Man and Monsters have speed Move up, down, left or right Add points Catch Has speed Move up, down, left or right Has speed Pacman Monster Monster Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 29

R08. If an enemy touches Pac-Man, a life is lost and the Pac-Man dies. Responsibilities: touch Pac-Man = catch Pac-Man Pac-Man has lives die = lose life = catch Move up, down, left or right Add points Has speed Has lives Die (instead of Catch) Pacman Monster Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 30

R09. When all lives have been lost, the game ends. Move up, down, left or right Add points Has speed Has lives Die Go to next maze End Responsibilities: lose life = die game ends Pacman Monster, Game Game Maze Pacman Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 31

R10. Sometimes larger dots known as power pellets appear randomly in the maze for a limited time. Responsibilities: power pellet appears -> who creates it? Game, Maze or? a power pellet has a timer Remove pellet Create power pellet Has timer Decrease time Maze, Power pellet Power pellet Add pellet Remove pellet Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 32

R11. The power pellets have many kinds. No new responsibilities -> nothing to do Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 33

R12. The power pellets give Pac-Man abilities. No new responsibilities -> nothing to do Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 34

R13. The life pellet gives Pac-Man a new life. Responsibility: add new life Move up, down, left or right Add points Has speed Has lives Die Add life Pacman Monster, Game Life pellet Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 35

R14. The maximum number of lives is five. Responsibility: number of lives is limited when a life is added Move up, down, left or right Add points Has speed Has lives Die Add life Pacman Monster, Game Life pellet Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 36

R15. If the maximum life number is reached and Pac-Man collects a life pellet, the pellet disappears without any effect. Responsibility: collect pellet = eat pellet remove pellet Pacman Move up, down, left or right Add points Has speed Has lives Die Add life Monster, Game Life pellet Add pellet Remove pellet Life pellet Eat Pacman Dr. Balázs Simon, BME, IIT 37

R16. Pac-Man can collect bomb pellets. Responsibility: collect bomb pellet = eat pellet Move up, down, left or right Add points Has speed Has lives Die Add life Has bombs Add bomb Eat Pacman Monster, Game Life pellet Bomb pellet Bomb pellet Pacman Dr. Balázs Simon, BME, IIT 38

R17. Pac-Man can collect at most five bomb pellets. Responsibility: number of bombs is limited when a bomb is added Move up, down, left or right Add points Has speed Has lives Die Add life Has bombs Add bomb Pacman Monster, Game Life pellet Bomb pellet Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 39

R18. If the maximum number of bomb pellets is reached, Pac-Man cannot collect any more, and the pellets remain in the maze. Life pellets and bomb pellets have different behavior! Move up, down, left or right Add points Has speed Has lives Die Add life Has bombs Add bomb Eat Pacman Monster, Game Life pellet Bomb pellet Bomb pellet Pacman Dr. Balázs Simon, BME, IIT 40

R19. Pac-Man can place the collected bombs in the maze. Responsibility: place bomb Move up, down, left or right Add points Has speed Has lives Die Add life Has bombs Add bomb Place bomb Pacman Monster, Game Life pellet Bomb pellet Bomb, Add pellet Remove pellet Add bomb Pacman, Bomb Dr. Balázs Simon, BME, IIT 41

R20. The bombs have a timer ticking backwards. Responsibilities: a bomb has a timer timer ticks backwards Has time Decrease time Bomb Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 42

R21. If the bomb s timer is expired, the bomb vanishes. Responsibility: bomb vanishes Has time Decrease time Bomb Add pellet Remove pellet Add bomb Remove bomb Pacman, Bomb Bomb Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 43

R22. If anyone (Pac-Man or a monster) touches the bomb before the time is expired, he dies. Responsibilities: touch bomb; die = lose life for Pacman Bomb Has time Decrease time Touch Pacman, Monster Add pellet Remove pellet Add bomb Remove bomb Remove Monster Pacman, Bomb Bomb Monster Monster Move up, down, left or right Has speed Die Bomb Dr. Balázs Simon, BME, IIT 44

R22. If anyone (Pac-Man or a monster) touches the bomb before the time is expired, he dies. Responsibilities: touch bomb; die = lose life for Pacman Bomb Has time Decrease time Touch Pacman, Monster... Remove Monster Remove Pacman Monster Pacman... Die Pacman Monster, Game, Bomb Dr. Balázs Simon, BME, IIT 45

R23. Collecting the bonus pellet gives 1000 points to Pac-Man. Move up, down, left or right Add points Has speed Has lives Die Add life Has bombs Add bomb Place bomb Responsibilities: collect pellet = eat pellet add points Pacman Bonus pellet, Bonus pellet Monster, Game Life pellet Bomb pellet Bomb, Eat Pacman, Dr. Balázs Simon, BME, IIT 46

R24. Monsters cannot pick up pellets. No new responsibilities -> nothing to do Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 47

R25. Monsters apply different strategies for catching Pac-Man. Responsibilities: monster steps Move up, down, left or right Has speed Die Step Monster Bomb Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 48

R26. Blinky always follows Pac-Man through the path Pac-Man used. Responsibilities: Blinky steps find the Path of Pacman -> Who finds this? Blinky, Maze, s, Pacman? Step Blinky Path Contains a list of fields Path Add pellet Remove pellet Add bomb Pacman, Bomb Remove bomb Bomb Remove Monster Monster Time since Pacman Maze Dr. Balázs Simon, BME, IIT 49 Reset time since Pacman Pacman

R26. Blinky always follows Pac-Man through the path Pac-Man used. Responsibilities: Blinky steps find the Path of Pacman -> Who finds this? Blinky, Maze, s, Pacman? Step Remove pellet Create power pellet Get Pacman s Path Blinky Maze, Path Maze, Power pellet, Path, Blinky Dr. Balázs Simon, BME, IIT 50

R27. Pinky goes toward Pac-Man on the shortest path. Responsibilities: Pinky steps shortest Path to Pacman -> Who finds this? Blinky, Maze, s, Pacman? Step Remove pellet Create power pellet Get Pacman s Path Get shortest Path to Pacman Pinky Maze, Path Maze, Power pellet, Path, Blinky, Path, Pinky Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 51

R28. Inky is stupid and only wanders randomly. Responsibilities: Inky steps Step Inky Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 52

R29. Clyde is a bit cleverer. He also wanders randomly, but when Pac-Man is near (within five steps), he starts chasing him using the shortest path. Responsibilities: Clyde steps Step Clyde Maze, Path Remove pellet Create power pellet Get Pacman s Path Get shortest Path to Pacman Maze, Power pellet, Path, Blinky, Path, Pinky, Clyde Entities: Game, Pacman, Maze,, Point, Monster, Blinky, Pinky, Inky, Clyde, Life, Power pellet, Ability, Life pellet, Bomb pellet, Bomb, Timer, Bonus pellet, Strategy, Path, Dr. Balázs Simon, BME, IIT 53

Other considerations Something needs to decrease timers, and make monsters move: Timer entity Ticks Notifies Bomb Notifies Power pellet Notifies Monster Has time Decrease time Touch Has timer Decrease time Timer Bomb Power pellet Monster Bomb Pacman, Monster Power pellet Timer, Timer Dr. Balázs Simon, BME, IIT 54

Other considerations Something needs to decrease timers, and make monsters move: Timer entity Ticks Notifies Bomb Notifies Power pellet Notifies Monster Move up, down, left or right Has speed Die Step Timer Bomb Power pellet Monster Monster Bomb Timer Dr. Balázs Simon, BME, IIT 55

Class diagram for Pacman Dr. Balázs Simon, BME, IIT 56

Class diagram Create classes from the CRC cards Create methods from the responsibilities Create common ancestors Thing: Pacman, Monster,, Bomb Steppable: Power pellet, Bomb, Monster Rename common responsibilities HitBy: Eat, Touch Add new responsibilities if necessary Dr. Balázs Simon, BME, IIT 57