![]() ![]() More importantly, it ruins the values of these attributes if you ever end up instantiating multiple Board objects in the same program. Sure, you might not instantiate Board multiple times now, but if you ever do later, there's no reason to have the code run twice. There's no benefit to having such code in _init_. It's really bad form to declare class attributes in Board's _init_ method because class attribute definitions only need to run once. Generally you should just avoid absolute conditionals and leave a TODO comment there to add remind yourself to add it in later.Ĭode smell: don't redefine class attributes as if they're instance attributes If you have a condition that should always be false, don't do elif True=False: just do elif False.It would be slightly easier to read the closing ] for Game.Board if it were on a separate line.If you're using Python 3.6, there's also a backport. If you're using Python 3.7 or later (which was not released at the time of this question's asking), you can utilize dataclasses for less boilerplate _init_() attribute code and descriptive object representation.Having an empty _init_() in Die is unnecessary because _init_() is empty by default.As mentions in comments, Dye should be Die.If you're using Python 3.x (which happens to be true, because you're using the print function without an import from _future_), classes with no superclass implicitly inherit from object, so there's never a need to have object as the superclass.Standard Edition (the 'Atlantic City Edition') is as follows. Cards The text on each card in the current (as of Sept. 3rd Space ( red ): Between Short Line and Park Place. 2nd Space ( blue ): Between Kentucky Avenue and Indiana Avenue. PEP 257 is recommended reading for how to write descriptive (and standardized) docstrings. 5 Gallery (Incomplete) Space Locations 1st Space ( pink ): Between Oriental Avenue and Vermont Avenue. However, your docstrings are not very descriptive of what the classes are intended for, or what the various attributes represent. Having docstrings is a nice touch, and generally a sign of a well-documented module.If the code was revised to incorporate the below feedback and asked as a new question, then further substantive critiques would be easier to make. Note this review relatively surface-level it doesn't delve into a complete dissection of how the program actually functions, but it does contain useful advice about general program structure. This is a quite a bit later than this question's post date, but perhaps this review can be useful to others. ![]() Pass # all other players bankrupt, end game Print("TODO: Code diplay owned properties function")Įlif True = False: #TODO:make function that checks if there is a winner #increment current_player.num_turns_in_jailĮlif True=False: #if player is bankrupt/ has lost Print("You chose not to buy ".format(option, menu))ĭid_his_time = Game.current_player.num_turns_in_jail = 3 "is insufficient to buy", self.name, "at the price of", Print("Your balance of", Game.current_player.balance, Print("Congratulations!", Game.current_player.name, Game.current_player.balance -= self.price Game.current_player.owned_properties.append(self) If Game.current_player.balance >= self.price: Selection = input("Select an option by typing a number: ") Game.display_menu(Game.unowned_property_menu) Print("You landed on an unowned property") from random import randintĭef _init_(self, name, price, base_rent, is_utility=False, If anyone has any suggestions or any feedback on the design of my project or anything else they can think of, please drop a comment below. The program is not complete yet but I felt that the program was good enough to share and ask for feedback at this point. I did this to practice Object Oriented Programming and have little to no background experience designing or programming games. In another episode, “Put Your Head On My Shoulder,” Bender uses punched cards to calculate matches for his dating service.I began to program the standard version of Monopoly so that it could be played only using the console. In the “Futurama” episode “Mother’s Day,” a robot burns a punched card in protest. thesis, a computer tic-tac-toe game, was written so long ago it was stored on punched cards. In “The Simpsons” episode “Much Apu About Nothing,” Apu’s Ph.D. Punched cards are still an occasional theme in television shows associated with the cartoonist, screenwriter, and producer Matt Groening. “Do Not Fold, Spindle or Mutilate” led to the casting of Helen Hayes and Mildred Natwick in the weekly detective series “The Snoop Sisters.” When one of the ladies gets hold of a computer-dating questionnaire, the others invent a mythical girl and feeds the falsified punch card information into the computer. The phrase “Do Not Fold, Spindle, or Mutilate” associated with punch cards inspired a 1971 movie starring Helen Hayes, Mildred Natwick, Myrna Loy and Sylvia Sidney as four elderly pranksters devoted to practical jokes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |