Skip to content

orabu103/HideAndSeekWithGhosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OOP Ex4

Created during a computer communication course during the second year at Ariel University in the Department of Computer Science, 2018
Project site: https://zvimints.github.io/OOP_3/.
Made by: Zvi Mints and Or Abuhazira

About The Project:

The Purpose of the game - Eat all the fruits and pacman on the board, and reach maximum score.

Load - First of all we need to load a CSV file that includes location of the pacman, fruit, ghost and boxes

Play - Then we need to select an initial position for the player and when you click play by pressing the mouse to change the position of the player.

Algo - By clicking on an algo we allow the algorithms to run.

Rating - When we click on statistics we will connect to a database which keeps all the data for our high score, the average of the other participants, and high score of the algorithm.

Example:

Project Diagram:

Class Hierarchy:

Packages:

Algorithm:

Coordinate - This is class that represent a Coordinate each Coordinate have x,y and pred.

FindShortestPathFromMat - The class is responsible to find the Shorest Path From input matrix.

GameToMatrix - This Class is responsible to convert from Game to Matrix used for taking steps in the Algorithm.

Maze - This Class is Responsible to Represent a Maze, Maze is a char[][] matrix with Objects such that Pacman that can be noticed by 'P' in the matrix, moreover we can see Objects Such that Fruit == 'F' ,Ghosts and Players.

The Algorithm of the project is as following:

Problem: for input file with number of Pacmans,Ghosts,Fruits find a route for a player to get the maximum score, when player can eat pacmans and fruits, and damaged by ghosts and boxes.

Solution:   (Pseudo code)

Greedy Algorithm:

0.Make Empty Queue (for the coordinates) and make Empty ArrayList (for the path)

1.Convert current game into a Matrix as described before

2.Make BFS SEARCH for finding the shortest path from START Point(Player Point) to END Point, used by the Matrix.

3.       IF coordinate is intersects Fruit or Pacman, Make BackTracking and return the path

4.       IF coordinate is near Ghost, CONTINUE

5.       IF coordinate is intersects Box,or in invalid point, CONTINUE

6.       ELSE, add to the Queue all the neighbors of the current coordinate

NOTE: BackTracking is adding to the ArrayList each Pred of the current Point, until the Pred is null

Coords:

This Class is responsible for actions between Objects of the kind Point3D. The Class is used to Provide a solution for elementary actions between vectors and points in R^3 Vector space.

File format:

This class is responsible to make Dynamic matrix[][] which is row contain Arraylist that represent line in csv the number of rows is the number of csv file lines.

Game:

This class represent Game which include Fruits List and Pacmans List, this class can init Pacmans and Fruits from Matrix.

GUI:

Menu - This class represent the GUI Menu of the Project.

Score - This class represents the game score and time remaining for the game in real time.

StatisticFrame - This class represent the GUI Statistic of the Project.

Statistic - This class is responsible for connecting to the DB and extracting information regarding statistics.

Map:

This class can convert Pixel point to Geo Point and back.

Each map containst Map Map (Image) that represent the background of the Game.

MyFrame:

AlgoThread - TThis Class is responsible for the "Client" algorithm side, this is thread that make all the choices for each step in the game.

GamePanel - The class is the main Panel of the game.

MyFrame - This Class is responsible for the Main connection between all classes we can run this game and get a Frame. connect GUI,Algorithm,Game,Play and more...

Object:

Element - This is an interface that each one of Fruit,Ghost,Pacman need to implement.

Box - This Class represent Box. Every Box has BoxData which include relevant information about the Box such that ID and Geoms.

Fruit - This Class represent Fruit. Every Fruit has FruitData which include relevant information about the Fruit such that ID and Geom.

Ghost - This Class represent Ghost . Every Ghost has GhostData which include relevant information about the Ghost such that ID, Speed, Radius and Geom.

Pacman - This Class represent Pacman . Every Pacman has PacmanData which include relevant information about the Pacman such that ID, Speed, Radius and Geom.

Player:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages