Skip to content

ArielZidon/Pokemon_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pokemon

Pokemon Game - PY

About The Project

In this project we created a simple game, which is about catching pokemos.
The game's purpose is to collect as many points as we can, while every pokemon has a different value of points.
The pokemons are located on a directed weighted connected graph.
Our task is to locate the agents at the graph in the best position we can (we chose to locate them on the center of the graph), and send them to catch the most suitable pokemons.
The consideration of a suitable pokemon relies on many different parameters:

  • The number of agent's moves it will take to get the pokemon.
    • It depends on the distance of the pokemon from the agent, which means the number of edges the agent needs to go and their weight.
  • The value of the pokemon.
    • Every pokemon has it's own value.
  • We have limited time and limited number of moves (10 moves per sec).
    • Which means we need to consider how to collect as many points as we can with this limitation.

The Creation Process

First of all, the directed weighted connected graph, the pokemons and the agents values are received in a Json format.
The graph's paramenters are it's nodes and edges. Every node has id number, geographical position value, edges that goes out of the node, and edges that goes to the node.
The Agent's parameters are it's id number, it's value, it's source and destination, it's speed and it's position.
The Pokemon's parameters are it's value, it's type and it's position.
We read the Json file and create all the above. To do this we created the class "argoments", where we receive the pokemons and the agents from the Json and create them.
In addition, we created the class "GraphAlgo" to load the graph from the Json file and to implement algorithms on it.
We created the class "Node" which represents a node of the graph, and the class Digraph which represents a graph.

Gif

The game algorithm

The cmd_solo

The program will call this action when it detects that there is one agent in the game, The function will go through all the Pokemon and give the agent the most suitable Pokemon according to the parameters given by the Shortest Path algorithm.

The cmd_group

The program will call this function when there is more than one agent. In this case the function will go over all the Pokemons and send to a Pokemon the most suitable agent, while at the end of the function we send this agent to the same Pokemon, and the other unsent agents will be passed to the "cmd_solo" function to get another Pokemon.

Graph's Algorithms

Shortest Path

Finds the shortest path in the graph between any 2 nodes we want. (Receives source node and destination node)

Center

Finds the node with the smallest trajectory value toward all other graphite nodes.

Dijkstra

dijkstra algorithm. https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

UML Diagram

diagram-17363877052811065234

Getting Started

Gif

Installation

In order to install the program you need to follow these steps:

  • Download/clone the project from git.
  • Extract the downloaded zip file.
  • Open the project in Python environment workspace (we used PyCharm).
    • Note(!!!): Download the library pygame.
  • Now that you have installed the project, follow the next section to understand how to use the program.

Usage

Click on the release tag and then download the zip file that is there:

image

image

In order to run the program follow these steps:

  • Open a new Terminal (if you use PyCharm, open the terminal at the lower toolbar)

  • Write the command : java -jar Ex4_Server_v0.0.jar "Case number"

    • At the "Case number" just write a number between 0-15 (without the """)
    • Press Enter, now the server is up.
    • Run class Ex4

    blue box - Enter the terminal.
    yellow box - The command to write.
    red box - run Ex4 class.

    • If you would like to exit the program before it ends, just press the "exit" button at the left upper corner of the window.

Appearance

You can see detailed information about the appearance of the project at the Wiki:

https://github.com/ArielZidon/Pokemon_Game/wiki/Visualization#a-short-video-of-the-game-running

Our Scores On The cases 0 - 15

Computer specifications:

The program ran on computer type: Lenovo ThinkPad T450 Ultrabook Laptop

Operating System: Edition Windows 10 Pro Version 20H2 Installed on ‎4/‎19/‎2021 OS build 19042.1415 Experience Windows Feature Experience Pack 120.2212.3920.0

Processor model: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz 2.30 GHz

Installer RAM : 16.0 GB (15.8 GB usable)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages