In Class: Week 12
Create a week12 subdirectory in your cs21/class directory:
% cd
% cd cs21/class
% pwd
/home/your_user_name/cs21/class
% mkdir week12
Then, from within your week12 subdirectory copy over some python files
from my public directory:
% cd week12
% pwd
/home/your_user_name/cs21/class/week12
% cp ~newhall/public/cs21/week12/* .
% ls
card.py deck.py digitalclock.py
We are going to do some of the following together:
- open up card.py and add a blackJackValue method function that
returns the Black Jack value of the card. Here are the Black Jack
values we are using:
- cards with rank 2-10 have a black jack value equal to their rank
- King, Queen, and Jack have a black jack value of 10
- Ace has a black jack value of 1
- open up deck.py and complete the constructor that creates a
deck of cards as a list of 52 Card objects of appropriate rank and
suit
- open up deck.py and complete the methods dealOneCard and cardsLeft and
test them.
- implement a regular function, playBlackJack, that plays one game
of black jack against the computer using a shuffled Deck.
- implement the rest of the classes in the digitalclock.py file to
create a digital clock that will be drawn to the graphics window.
It will look something like this when the time is 12:59:13: