tom and jerry
play

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


  1. Tom-and-Jerry Catching Game Platform Prototype Presentation

  2. Introduction

  3. A* Search? Depth-First Search? Breadth-First Search?

  4. What is Tom-and-Jerry? ▷ A Java framework. TJ Framework User’s input Visualization Predefined methods and classes

  5. Overview

  6. The World

  7. The World

  8. Class Diagram Framework User’s package Jerry MyJerry Agent Movable World Cheese Tom MyTom GridGraph Graphic Game GridCell

  9. Game World Graphic User

  10. MyJerry Class import TJPackage.Jerry; User’s public class MyJerry extends Jerry{ Input public MoveDirection move(){ Random rand = new Random(); MoveDirection randDirection; randDirection = MoveDirection.values()[rand.nextInt(5)]; return randDirection; } }

  11. Core Components

  12. 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.

  13. Disjoint Set ▷ A set containing subsets of joined elements join 2&3 {1,2,3,4,5,6,7} {1,{2,3},4,5,6,7} join 4&6 {1,{2,3,4,6},5,7} {1,{2,3},{4,6},5,7} join 2&4

  14. The Main Loop while (!gameConditionSatisfied()) for (Agent agent: agentList ){ if (agent instanceof Movable){ MoveDirection direction = ((Movable)agent).move(); updateAgentLocation(agent, direction); } } }

  15. Game Class Game + setJerry(Jerry): void + setTom(Tom): void + setDimension(int,int): void + setDifficulty(Difficulty): void + setCheeseNumber(int): void + randomNewMaze(): void + play(): void

  16. User Interface 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(); }

  17. Demonstration

Recommend


More recommend