Giter Club home page Giter Club logo

pokemon-oop-sample's Introduction

Pokemon

python-oop: command-line program

75 lines of code.

This simple command-line program in python shows how you can build a simple a command-line program in python using OOP concepts such as attributes, classes and methods.

How to execute this program

On the terminal, type the following command to run the program:

python3 -i pokemon.py

We can

>>> print(ravi)
Ravi (grass)
	100/100 HP.

>>> print(vira)
Vira (water)
	200/200 HP.

batle point

>>> ravi.battle(vira)
---#_<
Ravi (grass)
	100/100 HP. 
---
 Vira (water)
	200/200 HP.

---#_<
Battle:  Ravi vs Vira
	Ravi fought Vira,
		and the result is a win
Vira lost and now has 180 HP.

---#_<
Ravi (grass)
	100/100 HP. 
---
 Vira (water)
	180/200 HP

or

>>> vira.battle(ravi)
---#_<
Vira (water)
	200/200 HP. 
---
 Ravi (grass)
	100/100 HP.

---#_<
Battle:  Vira vs Ravi
	Vira fought Ravi,
		and the result is a lose
Vira lost and now has 180 HP.

---#_<
Vira (water)
	180/200 HP. 
---
 Ravi (grass)
	100/100 HP

CONCEPTS

  • Object-Oriented Programming in Python
  • game logic
  • instance methods
  • @staticmethod
  • self, other
  • init, str
  • if name == 'main'
  • importing your own code
  • scissor paper rock concept

License

This code is open source. So feel free to use, modify, share, download as per your need. I do not take risk or responsibility for your errors or any commercial damage.

pokemon-oop-sample's People

Contributors

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