Skip to content

Instantly share code, notes, and snippets.

@SteveHere
Last active July 4, 2022 02:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveHere/3af5953f42e4f7b1272c073b20fcd9d4 to your computer and use it in GitHub Desktop.
Save SteveHere/3af5953f42e4f7b1272c073b20fcd9d4 to your computer and use it in GitHub Desktop.
Small game about copyright (It's an RIAA world after all)
# From http://ars.userfriendly.org/cartoons/?id=20080727
import os, random
def screen_clear():
# for mac and linux(here, os.name is 'posix')
os.system('clear') if os.name == 'posix' else os.system('cls')
# Diamond, Heart, Club, Spades, in this order.
suits_map = { "D": True, "H": True, "C": False, "S": False, }
values_map = { "A": 1, "J": 11, "Q": 12, "K": 13, }
for x in range(2, 10 + 1):
values_map[str(x)] = x
cards = [(suit, value) for suit in suits_map.keys() for value in values_map.keys()]
gameboard_map = {
0: (0, "DISASTER", "Copyright for 40 Years; Fair Use Exists"),
1: (500, "TROUBLE", "Copyright for 70 Years; Fair Use Exists"),
2: (500, "CONCERN", "Copyright for Life + 25 Years; Fair Use Exists"),
3: (1000, "IRRITANT", "Copyright for Life + 50 Years; Fair Use Limited"),
4: (1500, "PROGRESS", "Copyright for Life + 75 Years; Fair Use Rare"),
5: (2000, "BLUE SKY!", "Copyright for FOREVAR; What's Fair Use?"),
}
money = 500
position = 2 # Start on 'CONCERN'
def wait_until_input(prompt, choices):
result = input(f"{prompt} ({'/'.join(choices)})")
while not result or len(result) < 1 or result[0].lower() not in "".join(choices).lower():
result = input(f"{prompt} ({'/'.join(choices)})")
continue
return result.upper()
def reset():
global money, position
money = 500
position = 2
def display_game_status():
print(f"Money: {money} \nGameboard:")
for s in range(6):
print(f"[{('', '*')[s == position]}] {gameboard_map[s][1]} - {gameboard_map[s][2]}")
def game_check():
global position, money
while money <= 0:
position, money = position - 1, money + 1000
print(f"It seems that you're out of money... \nMoving to {gameboard_map[position][1]}")
if position == 0:
return True
if money >= gameboard_map[position + 1][0]:
choice = wait_until_input(f"Do you want to lobby to {gameboard_map[position + 1][1]}?", ['Y', 'N'])
if choice[0] == "Y":
money, position = money - gameboard_map[position + 1][0], position + 1
print(f"Lobbied up to {gameboard_map[position][1]}")
return False
quit_game = False
while not quit_game:
if position in [0, 5]:
if position == 0:
print("You've lost... The Public Good has & is protected now.")
else:
print("You've won! Go afford yourself another Trophy Wife/Husband")
i = wait_until_input("Want to play again?", ['Y', 'N'])
if i[0] == "N":
quit_game = True
reset()
if not quit_game:
deck = list(cards)
random.shuffle(deck)
screen_clear()
display_game_status()
infringement = deck.pop()
print(f"Infringement card: {infringement}")
litigate_flag = True
choice_1 = wait_until_input("Litigate or Bully?", ['L', 'B'])
if choice_1[0] == "B":
card_2 = deck.pop()
print(f"Bully card: {card_2}")
if suits_map[card_2[0]]: # If card suit is red
winnings = values_map[infringement[1]] * 10
print(f"You've won ${winnings} from the settlement!")
money += winnings
litigate_flag = False
else:
damages = values_map[infringement[1]] * 25
print("They stood up to you...")
print(f"You're forced to pay ${damages} in fees & PR damage control.")
money -= damages
if choice_1[0] != "L":
lost = game_check()
if lost:
continue
# Litigate phase
if litigate_flag:
ruling = deck.pop()
print(f"Ruling card: {ruling}")
if values_map[ruling[1]] > values_map[infringement[1]]:
winnings = (values_map[ruling[1]] - values_map[infringement[1]]) * 100
print(f"You've won ${winnings} from the lawsuit!")
money += winnings
else:
loss = values_map[ruling[1]] * 100
print(f"You've lost the lawsuit... You're forced to pay ${loss}")
money -= loss
lost = game_check()
if lost:
continue
input("(Press enter to begin next round...)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment