You are on page 1of 3

Create – Applications From Ideas

Written Response Submission Template


Please see Assessment Overview and Performance Task Directions for Student for the task
directions and recommended word counts.

Program Purpose and Development

2a)

Blackjack is an online game of 21 I made in Python. The purpose of this program


is to help users devlop critical thinking skills and practice concentration through
an intense game.The program fulfills this purpose by dealing out a set of cards
and promting the user to make a deciosn based on the balue of their hand,
promting them to think ahead and then allowing them to review their past
actions and keep score of the game. This video illustrates the above features y
show one full game of 21 and how afte the user is given a hand they mist decide
to hit or stand and at the end the game decides who wins based on the basic
rules of 21. Addiotnally, the video shows how the progrm finnaly prints out who
won the round and the total score while also allowing the user to review their
deicsions.

2b)

An incremental process was when I developed the possible outcomes of the


game as the player can either bust, get 21 or have less than the computer so I
implemented one possible outcome at a time to ensure there were not
overlapping issues when I finished. Addionally an incremental proceess is an if
stement that issues a new card until until the user rechaes or exceed 21. An
interative procxess was when I added a loop for the computers play by using
comp.append(rc(cards)) to determine how the computer will gernrally play, thus
eliminateing the need tonset a difficulty or reprogram the dealer every time.Both
of these processes were completed independently. A diificulty faced was when I
had to find out a way to make my randon number generator run over and over
again until a winner was decided. I resolved this by using a while True:
statement to ensures trhat program would not stop running until one side won.
Addiotnally, a difficulty was when I needed to make the program print out the
total score and I resolved this issue by using %d. Both of these difficulties were
resolved independently.

AP Computer Science Principles Effective Fall 2017 Page 1 of 3


2c)

The algorithm in my program is a while loop that includes two if-else statements.
The while loop iterates evrytime a player makes a dicsion to hit or stand and
determines how close th eplyaer is to 21. The 1st If staement determines if the
layer has a 'bust'. Else the if statement finds if the player has 21, and if not it
promts trhe user to hit or stand again. The second if statement determines who
is winning the vurrent game and prints a message based of the number of wins
each player has, if pbust or cbust == false then that player wins and vice versa.
All in all, this progam helps the purpose of the program by promting thw user to
make a decision based on what number cards rhey already have and keeping
track of their past deciosn keep score, and the two if statements play the role of
a nnbiased dealer and imporve the overall efficiency of the program.

AP Computer Science Principles Effective Fall 2017 Page 2 of 3


2d)

The abstarction developed individually is total(hand):, which is used to` decide


whether or not an ace is a 11 or 1 eliminating thw owrry for having the user
dcide what to do with the hand. Math is intertwined here as in oder to
determine whether or not the sum is grater than or less than 21 and the
hand.count is greater than zero to detemine what to do with the ace. An
example of a logical concept is an while loop that what to make the ace based on
the current count. This is done by collecting the results of the mathmatecial
conept to detemie what value (1 or 11) will put the player in the best postion as
if the hand is less than less than 10 the ace will be 11 or if the hand is less than 1
it will only add 1.

Link for Student Created Black Jack Game: Blackjack by Xavier

AP Computer Science Principles Effective Fall 2017 Page 3 of 3

You might also like