Scissor, Paper, Stone…but with Pokemon!

This week at Code Club I taught Python Lesson 2 (Scissors, Paper, Stone) . When I got home I showed my son (who is a massive Pokemon fan) how the lesson can be expanded to make a slightly more complicated version that included names and the option to keep playing with out having to manually re-run the script.

———-

#geektechstuff

#Scissor, Paper, Stone with Pokemon!

# Please note: Nintendo, Game Freak and Creatures (The Pokemon Company) own the copyright

# / hold all licensing rights to Pokemon.

from random import randint

#for random intergers

trainer_name = input(‘What is your name?’)

trainer_name=trainer_name.title()

#defines retart function to restart the game

def restart():

    reset=input(‘Play again? Y / N:’)

    reset=reset.lower()

    if reset == ‘y’:

        game()

    if reset ==’n’:

        print(‘Good bye’)

#defines the game

def game():

    trainer_pokemon = input(‘Which Pokemon will you send out: Bulbasaur (B), Charmander (C) or Squirtle (S)?’)

    trainer_pokemon=trainer_pokemon.lower()

    pokemon_name=””

    if trainer_pokemon==’b’:

        pokemon_name=’Bulbasaur’

    elif trainer_pokemon==’c’:

        pokemon_name=’Charmander’

    elif trainer_pokemon==’s’:

        pokemon_name=’Squirtle’

    

    print(”)

    print(trainer_name,’sent out’,pokemon_name)

    comp_trainer_name=””

    comp_t_rand=randint(1,4)

    if comp_t_rand==1:

        comp_trainer_name=’Gary Oak’

    elif comp_t_rand==2:

        comp_trainer_name=’Jessie (Team Rocket)’

    elif comp_t_rand==3:

        comp_trainer_name=’James (Team Rocket)’

    elif comp_t_rand==4:

        comp_trainer_name=’Cyrus (Team Galactic)’

    comp_pokemon=””

    comp_pokemon_name=””

    comp_poke_rand=randint(1,3)

    if comp_poke_rand==1:

        comp_pokemon=’b’

    elif comp_poke_rand==2:

        comp_pokemon=’c’

    elif compgar_poke_rand==3:

        comp_pokemon=’s’

    if comp_pokemon==’b’:

        comp_pokemon_name=’Bulbasaur’

    elif comp_pokemon==’c’:

        comp_pokemon_name=’Charmander’

    elif comp_pokemon==’s’:

        comp_pokemon_name=’Squirtle’

    

    print(”)

    print(comp_trainer_name,’sent out’,comp_pokemon_name)

    print(”)

    print(pokemon_name,’and’,comp_pokemon_name,’battle it out!’)

    if trainer_pokemon == comp_pokemon:

        print(‘This battle is too even to declare a winner’)

    elif trainer_pokemon==’b’ and comp_pokemon==’s’:

        print(pokemon_name,’defeats’,comp_pokemon_name)

        print(‘You win!’)

    elif trainer_pokemon==’c’ and comp_pokemon==’b’:

        print(pokemon_name,’defeats’,comp_pokemon_name)

        print(‘You win!’)

    elif trainer_pokemon==’s’ and comp_pokemon==’c’:

        print(pokemon_name,’defeats’,comp_pokemon_name)

        print(‘You win!’)

    else:

        print(comp_trainer_name,’has used’,comp_pokemon_name,’and defeated’,pokemon_name)

    restart()

#game() calls the game funtion and starts the game    

game()

One thought on “Scissor, Paper, Stone…but with Pokemon!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.