Hidden WordScanner
Private scans · No account required

DuckieDai Blackjack

A simple game of blackjack against the dealer: hit or stand to get closer to 21 without going over, with a running tally of wins, losses, and pushes.

games · MIT License

Overview

A simple game of blackjack against the dealer: hit or stand to get closer to 21 without going over, with a running tally of wins, losses, and pushes.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 1616 bytes
  • Uses random

Before you run it

  • TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
  • TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
  • Every card is drawn at random from an endless deck, so any card can come up at any time.
  • There is no betting; the game keeps a count of wins, losses, and pushes while it runs.
  • Only 1 (hit) and 2 (stand) are accepted on your turn; anything else asks again.

Play it here first

Play a full round right here before you download. The screen below runs the same steps as the calculator game: type your answer in the box under it and press Enter, just as you would on the calculator. Each round picks a new secret, and nothing you type is saved.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

How to play

How to play Blackjack

About the game

You and the dealer each get two cards. The goal is to finish closer to 21 than the dealer without going over. Going over 21 is a bust, and a bust loses straight away.

Number cards count their number, J, Q, and K count 10, and an Ace counts 11, or 1 if 11 would put the hand over 21. There is no betting: the game just keeps a tally of wins, losses, and pushes (ties).

Controls

1
hit: take another card
2
stand: keep your total and let the dealer play
enter
confirm your choice
Y
deal another hand; any other answer ends the game

How to play

Tips

Good to know

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. # DuckieDai(TM) Blackjack
  2. # TI-84 Plus CE Python
  3. from random import randint
  4. def clear():
  5. print('\n'*7)
  6. def card():
  7. n=randint(1,13)
  8. if n==1:return 11,'A'
  9. if n==11:return 10,'J'
  10. if n==12:return 10,'Q'
  11. if n==13:return 10,'K'
  12. return n,str(n)
  13. def score(hand):
  14. t=sum(hand)
  15. a=hand.count(11)
  16. while t>21 and a:
  17. t-=10
  18. a-=1
  19. return t
  20. def draw(hand,names):
  21. v,s=card()
  22. hand.append(v)
  23. names.append(s)
  24. def show(who,names,hand):
  25. print(who+':',' '.join(names))
  26. print('Total:',score(hand))
  27. def intro():
  28. print('DUCKIEDAI(TM)')
  29. print('BLACKJACK')
  30. print(' __')
  31. print(' ___(o )> quack!')
  32. print(' \\ <_. )')
  33. print(" `---'")
  34. print('by DuckieDai')
  35. print('hiddenwordscanner.com')
  36. input('Press Enter ')
  37. clear()
  38. intro()
  39. w=l=p=0
  40. while 1:
  41. h=[];hn=[];d=[];dn=[]
  42. for i in range(2):
  43. draw(h,hn)
  44. draw(d,dn)
  45. clear()
  46. print('BLACKJACK')
  47. print('Dealer:',dn[0],'?')
  48. show('You',hn,h)
  49. ps=score(h);ds=score(d)
  50. if ps==21 or ds==21:
  51. pass
  52. else:
  53. while ps<21:
  54. c=input('1 Hit 2 Stand? ')
  55. if c=='2':break
  56. if c!='1':continue
  57. draw(h,hn)
  58. clear()
  59. print('Dealer:',dn[0],'?')
  60. show('You',hn,h)
  61. ps=score(h)
  62. if ps<=21 and ds!=21:
  63. while score(d)<17:
  64. draw(d,dn)
  65. clear()
  66. show('Dealer',dn,d)
  67. show('You',hn,h)
  68. ps=score(h);ds=score(d)
  69. if ps>21:
  70. print('BUST! You lose.')
  71. l+=1
  72. elif ds>21 or ps>ds:
  73. print('YOU WIN! QUACK!')
  74. w+=1
  75. elif ds>ps:
  76. print('Dealer wins.')
  77. l+=1
  78. else:
  79. print('PUSH! Tie game.')
  80. p+=1
  81. print('Wins:',w,'Losses:',l)
  82. print('Pushes:',p)
  83. if input('Again? Y/N ').upper()!='Y':break
  84. clear()
  85. print('DuckieDai(TM) done!')
  86. print('hiddenwordscanner.com')
Filename
BLACKJ.py
Size
1616 bytes
SHA-256
c6b24899cafcca1499718761c019468c94a2bba8cfdbc5b3a31163ca055672a1

Usage

Inputs

  • 1 to hit or 2 to stand
  • Y to deal another hand, anything else to stop

Outputs

  • Your cards and total, with one dealer card showing
  • Both final hands and totals, then BUST, YOU WIN, Dealer wins, or PUSH
  • Running totals of wins, losses, and pushes

Units: Card points; no units.

Assumptions and limitations

Assumptions

  • Every card is drawn at random from an endless deck, so any card can come up at any time.
  • There is no betting; the game keeps a count of wins, losses, and pushes while it runs.

Constraints

  • Only 1 (hit) and 2 (stand) are accepted on your turn; anything else asks again.
  • The dealer draws until reaching 17 or more and then stands, including on a soft 17.

Known failures

  • A two-card 21 is not paid extra; it wins like any other higher total, and two 21s tie.
  • The win, loss, and push totals reset when the program is started again.

Compatibility and review

Review status
Owner-tested on a TI calculator
Tested on
Owner reports personally playing this game on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
What happened
Owner reported pass on the calculator. The file is published exactly as provided; this exact file has not yet been rerun on a calculator.
Dependencies
random
Suggested calculator name
BLACKJ — you can give it another valid, unique name when you transfer it
Desktop test cases
Not available for this interactive-only source

This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.

Transfer and launch

Download the .py file, send it to your calculator with TI Connect CE as BLACKJ or another name, then open the Python App and start a game. Press [on] to stop at any time. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.

Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.

Version history

Enjoying a DuckieDai game? Every game and program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.

Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.

Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.