GithubHelp home page GithubHelp logo

pokemon_battle's Introduction

Pokemon_battle

This Python applicatication simulates a battle between two Pokemon using a formula basen on Generation 1 and takes into consideration the type advantage of each attack against the types of the enemy pokemon. The battle has 6 turns meaning each pokemon attacks 3 times If no Pokemon hp has reached 0 then the Pokemon with the highest remaining hp wins.

Technologies used:

  • Requests to PokeAPI to gather information for each Pokemon
  • Cache memory to store each Pokemon's info so the application will not make unnecessary API calls for the same Pokemons
  • Flask to set up a local server which allows the user to communicate with the application via routing
  • MySQL database to store the battle logs
  • Docker for dockerization of the MySQL database and main Python application in seperate containers

How to run:

Requirments:

From inside the directory where the docker-compose.yaml is run the command:

docker-compose up

This will use the docker-compose.yml file and take instruction to set up a container battle_app main application and the MySQL database. When you see that both pokemon_app and mysql_db containers are running you can open a browser window and access them with the following URLs:

Make two Pokemon battle

http://localhost:5000/battle?pokemon1=<pokemon_name_1>&pokemon2=<pokemon_name_2> 

Where <pokemon_name_1> is the name of the first pokemon and <pokemon_name_2> is the name of the second pokemon After entering the URL, a json response should appear displaying the winner, the battle log with each attack and both Pokemon IDs containing their name, stats and types

Show previous battle logs from database

http://localhost:5000/show_previous_battles

This returns all previous winners and battle logs that where stored in the database. Note that after shutting the db container all entries are deleted

To shut down the containers use the command:

docker-compose down

This will only delete the deocker containers. If you want to delete the volumes as well use the '-v' argument. To delete the docker images use the '--rmi all' argument

pokemon_battle's People

Contributors

davidparastatidis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.