This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Screen: | |
def __init__(self, size): | |
self.size = size | |
# create an array with `size` lines of `size` dots | |
# multiplying a string like `"hello world! " * 20` | |
# then multiplying the array | |
self.screen = ['.' * size] * size | |
def __str__(self): | |
return str.join("\n", self.screen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
pet = { | |
"name": input("Name your pet!\n>"), | |
"hunger": 0, | |
"happiness": 100, | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TYPES_IDX = ["normal", "fire", "water", "electric", "grass", "ice", "fighting", | |
"poison", "ground", "flying", "psychic", "bug", "rock", "ghost", "dragon", | |
"dark", "steel", "fairy", ] | |
EFFECTS = [ | |
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 0, 1, 1, 0.5, 1, ], | |
[ 1, 0.5, 0.5, 1, 2, 2, 1, 1, 1, 1, 1, 2, 0.5, 1, 0.5, 1, 2, 1, ], | |
[ 1, 2, 0.5, 1, 0.5, 1, 1, 1, 2, 1, 1, 1, 2, 1, 0.5, 1, 1, 1, ], | |
[ 1, 1, 2, 0.5, 0.5, 1, 1, 1, 0, 2, 1, 1, 1, 1, 0.5, 1, 1, 1, ], | |
[ 1, 0.5, 2, 1, 0.5, 1, 1, 0.5, 2, 0.5, 1, 0.5, 2, 1, 0.5, 1, 0.5, 1, ], | |
[ 1, 0.5, 0.5, 1, 2, 0.5, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 0.5, 1, ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import random | |
# this function will prompt the user every choice in array `choices` | |
# they must select with a number. returns the index they selected | |
def multiple_choice(choices): | |
highest_choice = len(choices) | |
for i, choice in enumerate(choices): | |
print(i + 1, choice) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
player_health = 100 | |
player_experience = 0 | |
player_name = input("Welcome to the land of the Ylsides, what is your name? ") | |
def start_fight(enemy_name, enemy_health, enemy_damage, experience_awarded): | |
# Global variables to be modified. |