Question
Task 3 - Gronky Starter Code: unit6_task3.zip You will complete a program for a brand-new kind of card game. The game is called Gronky. It
Task 3 - Gronky Starter Code: unit6_task3.zip
You will complete a program for a brand-new kind of card game. The game is called Gronky. It is similar to a regular deck of cards, with some slight changes. Starter code has been provided. Use the starter code and only fill in required areas. This includes the spots marked and adding missing functions or methods as indicated. You should not be modifying existing code. Your submission should include five files: task3.py, gronkyutil.py, deck.py, card.py, plan3.txt.
Overview You will figure out how many cards you need in the deck to fulfill the requirements Each card has three components Id: unique integer for each card (lowest id number is 0, largest is one less than number of cards) Title: Numbers one through ten, Baker, Jester, Page, Scribe, Squire, Armorer, and Marshal Gang: Jets, Pollos, Slugs, Yokels, Keiths, and Elbows Each card is unique, meaning there are no cards that match all three components. The Id can be used to determine its title and gang. Every possible combination of Title/Gang must be present in the deck of cards
Requirements Create a file called plan3.txt Include the Software design for your search and sort functions (three total) No other UML, design, or plan is required. Add to a class called Card in card.py Used to create a single card for the deck Fill in partial lines of code for getTitle() and getGang() Add two dunder methods in order to meet other program requirements Add to a class called Deck in deck.py Used to create a single deck of cards Fill in three lines/sections as indicated Use the module called gronkyutil.py This stores the map for TITLE and GANG It contains a function you can use to check to see if your id to title/gang conversion is working properly. It may also come in handy somewhere else (hint hint). Change the unit6_task3_starter.py file name to task3.py. Main menu Each menu option should result in a function call, except for option 5 The function signature for option 1 is included and should help you with the others Display Display each card in the hand on a single line Use the print() with the card object as the parameter Ex. print(card1) This means you should not call a method on the card object to determine what to print Each card should be displayed as "Title of Gang" Ex. Baker of Slugs Sort by Title Perform a sort using a selection, insertion, or bubble sort. A message should indicate which sort is used Use an existing function in the code to make it appear as if the program is processing Do not display the list of cards. The user should choose to display it after the sort is complete Sort by Gang Perform a sort using a selection, insertion, or bubble sort. Do not use the same sort technique as the Sort by Title A message should indicate which sort is used Use an existing function in the code to make it appear as if the program is processing Do not display the list of cards. The user should choose to display it after the sort is complete Search for Card Display submenus to allow the user to select a Title and Gang for the card to search for Use an existing sort algorithm to sort the hand Perform a binary search to determine if the card is in the hand Display a message indicating whether or not the card is in the hand
'''task4.py: This file runs the program and uses the orbian.py file. Use the starter code for this file. Only modify the sections indicated. Use the existing code to help you know how to build orbian.py''' from modules.orbian import Orbian from time import sleep from random import randint from random import shuffle # Hint hint def main(): print("WELCOME TO ORBIAN FAMILY") print() family = [] input("Hit Enter to Create the First Four Orbians") for i in range(0, 4): name = input("\tEnter a name for Orbian " + str(i + 1) + ": ") # The first four Orbians are created with random values headRadius = randint(2, 5) bodyRadius = randint(3, 8) bodyHeight = randint(5, 15) family.append(Orbian(name, headRadius, bodyRadius, bodyHeight)) print("\tCreating your Orbian Family", end="") thinking() done = False while not done: print() print("Menu") print("\t1) Meet Orbian Family") print("\t2) Compare Orbians") print("\t3) Orbian Info") print("\t4) Create Orbian Baby") print("\t5) Send to Pasture") print("\t6) Orbian Thanos") print("\t7) Quit") choice = int(input("Choose an option: ")) print() if choice == 1: listFamily(family) elif choice == 2: compare(family) elif choice == 3: info(family) elif choice == 4: createBaby(family) elif choice == 5: toPasture(family) elif choice == 6: thanosSnap(family) elif choice == 7: done = True print("Thanks for playing Orbian Family!!!") def thinking(): for i in range(5): print(".", end="") sleep(0.5) # You can comment this out while testing to make things go faster print() def selectOrbian(famList, selected=None): count = 1 for i in famList: print("\t" + str(count) + ") " + i.getName(), end="") if selected is not None and i is selected: print(" (already selected)") else: print() count += 1 return famList[int(input("Select an Orbian: ")) - 1] # Returns an Orbian object ########### DO NOT MODIFY ANY CODE ABOVE THIS LINE ############## ########### Define/Complete the functions below ################### def listFamily(famList): # <<<<<<<<<<<<<< Write code to list the Orbian family >>>>>>>>>>>>>>> pass # Remove this line to work on this function. It is here to prevent errors until it's defined def compare(famList): #<<<<<<<<<<<<<< Write code to select two orbians to compare >>>>>>>>>>>>>>> orb1 = orb2 = None # Remove this line to work on this function. It is here to prevent errors until it's defined ########### DO NOT MODIFY THIS FUNCTION BEYOND THIS LINE ############ if (orb1 == orb2): print("\tOrbian " + orb1.getName() + " is equal to Orbian " + orb2.getName()) elif (orb1 > orb2): print("\tOrbian " + orb1.getName() + " is bigger than Orbian " + orb2.getName()) else: print("\tOrbian " + orb1.getName() + " is smaller than Orbian " + orb2.getName()) def createBaby(famList): #<<<<<<<<<<<<<< Write code to select two orbians to be parents >>>>>>>>>>>>>>> orb1 = orb2 = None # Remove this line to work on this function. It is here to prevent errors until it's defined ########### DO NOT MODIFY THIS FUNCTION BEYOND THIS LINE ############ famList.append(orb1 + orb2) print("\tGreetings Orbian " + famList[len(famList) - 1].getName()) def info(famList): ########### DO NOT MODIFY THIS FUNCTION ############ print("Select an Orbian to view") orbian = selectOrbian(famList) print("Orbian " + orbian.getName() + " is " + str(orbian.getAge()) + " zungs old") # Age measured in zungs print("\tand is " + str(orbian.getVolume()) + " zogs, and " + str(len(orbian)) + " zings") # Volume measured in zogs, Height in zings def toPasture(famList): #<<<<<<<<<<<<<< COMPLETE THIS ENTIRE FUNCTION >>>>>>>>>>>>> pass # Remove this line to work on this function. It is here to prevent errors until it's defined def thanosSnap(famList): print("Uh oh. Orbian Thanos just snapped his fingers") thinking() #<<<<<<<<<<<<<< COMPLETE THE REST OF THIS FUNCTION >>>>>>>>>>>>> main()
'''orbian.py: Contains the class definition for Orbian. See the rest of the assignment description for all details. Use the orbian_starter.py file to get started.''' from math import pi from random import shuffle # Hint hint from random import randint import time class Orbian: # DO NOT MODIFY THE CONSTRUCTOR def __init__(self, name, headRadius, bodyRadius, bodyHeight): # NOTE: These are constants self.__HEAD_RADIUS = headRadius self.__BODY_RADIUS = bodyRadius self.__BODY_HEIGHT = bodyHeight self.__NAME = name self.__BIRTH_TIME = time.time() # This is the only variable self.__adult = False def __getHeadVolume(self): return 4 / 3 * pi * self.__getHeadRadius() ** 3 def __getBodyVolume(self): return pi * self.__getBodyRadius() ** 2 * self.__getBodyHeight() def __ageCheck(self): # Become an adult at 2 if self.getAge() >= 2: self.__adult = True ####### ADD OTHER REQUIRED METHODS BELOW. SEE THE ASSIGNMENT DESCRIPTION AND OTHER STARTER CODE FOR INSIGHT ######
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started