Hello I am trying to re-create the card game Uno for my homework and need some assistance

1 answer below »
Hello I am trying to re-create the card game Uno for my homework and need some assistance
Answered 7 days AfterMar 06, 2021

Answer To: Hello I am trying to re-create the card game Uno for my homework and need some assistance

Neha answered on Mar 07 2021
146 Votes
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Homework 2 - Creating the game Uno"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Homework 2 is an individual assignment that will focus on the object-oriented principles. Your homework needs to implement object oriented principles and should be interactive so that the user can play around with it. The code base needs to be entirely composed of objects (at least 5 should be in your creation) and should be called from the command line as a .py file so it can be easily ported to to a production scenario."
]
},
{
"cell_type": "markdown",
"metadata
": {},
"source": [
"\n",
"## Requirements & Limits\n",
"\n",
"You should aim for around 300 to 500 lines of code. You will not be graded on the number of lines of code you write nor will this be a comparison of projects implemented by your peers. For example, a project with 500 lines of code is not guaranteed to do better than a project with 300 lines of code. As we've seen, it's not necessarily the number of lines, it's the value in those lines. Being concise is a good thing and if you're at all worried that you're not going to hit that *soft* requirement please let us know.\n",
"\n",
"- **This assignment must be composed entirely of objects, with only scripting outside of objects when absolutely necessary**\n",
"- This assignment must not exceed 750 lines of code\n",
" - The line count requirement does not include whitespace or comments (please include both to make your code readable)\n",
"- **Your code should be sufficiently complex to require at least 5 separate classes** (but are not likely to need more than 10 classes)\n",
"- The objects should be different levels of complexity, for example some may be basic containers and others should manage those containers (i.e. a menu-serving object and/or a game-play object) as well as demonstrating various flow control and data types\n",
"- The assignment will be run from the command line as a .py file.\n",
"- The assignment needs to have a user-interface and be interactive with a user\n",
"- The assignment needs to do some user error checking as well as have a help 'screen' or printed instructions for the user\n",
"- All code needs to be well commented with both comments and docstrings\n",
"- Without specific permission, you may not use anything outside of the standard Anaconda-installed libraries. \n",
"- Please include all references that you used to build out your application. \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What you will be creating \n",
"\n",
"Every player starts with seven cards, and they are dealt face down. The rest of the cards are placed in a Draw Pile face down. Next to the pile a space should be designated for a Discard Pile. The top card should be placed in the Discard Pile, and the game begins!\n",
"\n",
"You have to match either by the number, color, or the symbol/Action. For instance, if the Discard Pile has a red card that is an 8 you have to place either a red card or a card with an 8 on it. You can also play a Wild card (which can alter current color in play). \n",
"\n",
"If the player has no matches or they choose not to play any of their cards even though they might have a match, they must draw a card from the Draw pile. If that card can be played, play it. Otherwise, keep the card, and the game moves on to the next person in turn. You can also play a Wild card, or a Wild Draw Four card on your turn.\n",
"\n",
"The game continues until a player has one card left. The moment a player has just one card they must yell “UNO!”. If they are caught not saying “Uno” by another player before the next player has taken their turn, that player must draw two new cards as a penalty."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Examples of sample classes \n",
"\n",
"## Class Card:\n",
"Setting up the rank and color of card. All setting up the special cards which are skip, reverse, draw2,\n",
"draw4, wild.\n",
"## Class Deck:\n",
"The Deck that will hold are cards. Will make sure each player gets 7 cards. Shuffle the deck before\n",
"distributing as well\n",
"\n",
"Shuffle: random shuffling of the cards before they are passed out\n",
"\n",
"Deal: deal the cards using .pop()\n",
"## Class Opponent\n",
"We will be playing against a computer so only two players will be playing!\n",
"## Class Player_Hand:\n",
"Will display what cards are in the players hand. This will also manage when player draws a card from the\n",
"deck or play a card\n",
"\n",
"Num_of_Cards: displays all cards in hand\n",
"\n",
"Add_card: will append what you have in your hand by one card when you don’t have something to play\n",
"\n",
"Remove_card: will play a card (.pop())\n",
"\n",
"Cards_in_Hand: displays cards that are in hand\n",
"\n",
"Last_Card: will let you know where there is 1 card in your hand and will display “UNO”\n",
"## Class Special_Cards:\n",
"This is where all the special cards will be played (Skip, Reverse, Draw2, Draw4, Wild)\n",
"\n",
"Card_Skip: skip a player, move on to next person in rotation\n",
"\n",
"Card_Reverse: reverse the order of play\n",
"\n",
"Card_Draw2: two cards will be drawn from the deck\n",
"\n",
"Card_Draw4: four cards will be drawn from the deck\n",
"\n",
"Card_Wild: player who played the card can change the color\n",
"## Class Game:\n",
"This will run the whole game. Outputs of what is going on (will tell you what cards have been played),\n",
"what action you want to do (play a card or pick a card from deck if you don’t have anything to play),\n",
"show you what cards you have remaining, etc. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"import time\n",
"from IPython.display import clear_output"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"color = ('RED','GREEN','BLUE','YELLOW')\n",
"rank = ('0','1','2','3','4','5','6','7','8','9','Skip','Reverse','Draw2','Draw4','Wild')\n",
"ctype = {'0':'number','1':'number','2':'number','3':'number','4':'number','5':'number','6':'number',\n",
" '7':'number','8':'number','9':'number','Skip':'action','Reverse':'action','Draw2':'action',\n",
" 'Draw4':'action_nocolor','Wild':'action_nocolor'}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"class Card:\n",
" ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here