Skip to content

Instantly share code, notes, and snippets.

@chasinglogic
Created September 24, 2013 19:46
Show Gist options
  • Save chasinglogic/6690251 to your computer and use it in GitHub Desktop.
Save chasinglogic/6690251 to your computer and use it in GitHub Desktop.
Code for a Magic: The Gathering Cube Maker I'm writing
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("Welcome To Mat's Super Duper Cube Maker")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("This application doesn't check card names or legality or anything like that\nNote that means if you misspell a name or enter a fake card.\nThis program won't know that it isn't real.")
print("It's a basic application that will make sure you get the right number of cards \nin your cube per color")
print("Then it prints your cube list to an easy to read Text File")
print("Currently it only supports 360 card cubes.")
print("Later functionality is planned to add things like cmc, power/toughness, etc.\n\n")
# NEED FUNCTION FOR SAVING TO FILE
#Function to determine how many of each color.
def cube_size(cubesize):
colored_cards = cubesize / 4
return coloredcards
#Function for entry of cards.
def card_entry(color, cubesize):
coloredcards = cube_size(cubesize)
count = 0
while count < coloredcards:
cmc = input("CMC of your card: ")
color[cmc][count] = input("Cardname: ")
# The Dicts For each color
white = {}
blue = {}
black = {}
red = {}
green = {}
artifacts = {}
multicolor = {}
land = {}
#The dictionary for the whole cube
cube = {"White": white, "Blue": blue, "Black": black, "Red": red, "Green": green, "Artifacts": artifacts, "Multicolor": multicolor, "Land": land}
quit = False
while quit == False:
print("Options are: \nC: Enter your Cube Size DO THIS FIRST\nE: Enter Cards \nS: Save cube list to file\nQ: Quit")
ui = input("What would you like to do?: ")
if ui.lower() == "c":
cubesize = input("How big is your cube?: ")
if ui.lower() == "e":
#find out what color
print("Note: Artifacts, lands, and Multicolor are considered colors for this program.")
what_color = input("Ok which color would you like to enter for?: ")
#If statements check which color and then execute card_entry for that color
if what_color.lower() == "white":
card_entry(white, cubesize)
if what_color.lower() == "blue":
card_entry(blue, cubesize)
if what_color.lower() == "black":
card_entry(black, cubesize)
if what_color.lower() == "red":
card_entry(red, cubesize)
if what_color.lower() == "green":
card_entry(green, cubesize)
if what_color.lower() == "artifacts":
card_entry(artifacts, cubesize)
if what_color.lower() == "multicolor":
card_entry(multicolor, cubesize)
if what_color.lower() == "land":
card_entry(land, cubesize)
# NEEDS CODE WRITTEN FOR WRITING TO FILE
if ui.lower() == "s":
print("Error: Not Valid Option Yet")
break
#Quits the program
if ui.lower() == "q":
quit = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment