Tom-and-Jerry Catching Game Platform Prototype Presentation - - PowerPoint PPT Presentation
Tom-and-Jerry Catching Game Platform Prototype Presentation - - PowerPoint PPT Presentation
Tom-and-Jerry Catching Game Platform Prototype Presentation Introduction A* Search? Depth-First Search? Breadth-First Search? What is Tom-and-Jerry? A Java framework. TJ Framework Users input Visualization Predefined methods and
Introduction
Depth-First Search? Breadth-First Search? A* Search?
▷ A Java framework.
What is Tom-and-Jerry?
TJ Framework
User’s input Visualization Predefined methods and classes
Overview
The World
The World
Class Diagram
User’s package
MyJerry MyTom Game Jerry Tom Agent Cheese Graphic GridCell GridGraph World Movable
Framework
World Game User Graphic
import TJPackage.Jerry; public class MyJerry extends Jerry{ public MoveDirection move(){ Random rand = new Random(); MoveDirection randDirection; randDirection = MoveDirection.values()[rand.nextInt(5)]; return randDirection; } }
MyJerry Class
User’s Input
Core Components
Creating The Maze
▷ The world consists of rows x columns cells ○ Ex. 4x4 world will have 16 cells. ○ Each cell is a node in the graph ▷ Initially, all cells are walled up.
Disjoint Set
▷ A set containing subsets of joined elements
{1,2,3,4,5,6,7}
join 2&3
{1,{2,3},4,5,6,7}
join 4&6
{1,{2,3},{4,6},5,7}
join 2&4
{1,{2,3,4,6},5,7}
The Main Loop
while(!gameConditionSatisfied()) for(Agent agent: agentList){ if(agent instanceof Movable){ MoveDirection direction = ((Movable)agent).move(); updateAgentLocation(agent, direction); } } }
Game Class
Game
+ setJerry(Jerry): void + setTom(Tom): void + setDimension(int,int): void + setDifficulty(Difficulty): void + setCheeseNumber(int): void + randomNewMaze(): void + play(): void
import TJPackage.Game; public static void main(String[] args){ Game.setJerry(new MyJerry()); Game.setTom(new MyTom()); Game.setDifficulty(Difficulty.HARD); Game.setDimension(5, 5); Game.setCheeseNumber(1); Game.play(); }