Closed tommeagher closed 5 years ago
@meli-lewis & @elainewong you should take a look at this issue in reference to https://github.com/ireapps/pycar/blob/master/completed/basics_complete_notebook.ipynb to see how you want to address it on Thursday, if you haven't already.
For 2020,
When we create dictionaries for play_card
and first_card
, we also create second_card
, third_card
and fourth_card
. We can add that to a list called columns = [first_card, second_card, third_card, fourth_card]
where we can do a for loop for comparison at the end.
Let's make sure that the solitaire example would move the card off the top deck and when we create a dictionary, we have a color key. i.e.
"value": 5,
"suit": "spade",
"color": "black"
}
So the example at the top can be done:
if play_card["suit"] != first_column_card["suit"]:
if play_card["color"] != first_column_card["color"]: # or create another dict with suits and colors to lookup
#run a function moving cards
pass
else:
print("You can't play on the same color")
else:
print("you can't play on the same suit")
else:
print("You can't play this card here")```
closed by 4432e38
Everything went great until we got to the last command
There's a big leap there, including a for loop for a list (
columns
) that we haven't created yet. We called an audible and instead added a conditional to check if the card is one less than the previous, and if the suit is the same.