Hidden WordScanner
Private scans · No account required

DuckieDai Duck Maze

A maze game: guide the duck through a new random maze each round, grab the treasure, then reach the exit in as few moves as you can.

games · MIT License

Overview

A maze game: guide the duck through a new random maze each round, grab the treasure, then reach the exit in as few moves as you can.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2888 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
  • Each round digs a new random 13 by 7 maze with exactly one path between any two open squares.
  • You start in the top-left corner and the exit is always in the bottom-right corner; the treasure is on a random open square.
  • Moves are typed with the number keys 8 (up), 2 (down), 4 (left), and 6 (right); several can be typed at once, such as 666.

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 Duck Maze

About the game

You are the duck, D, in a maze of # walls. Find the treasure, T, then waddle to the exit, E, in the bottom-right corner.

Every round digs a brand-new random maze. There is always exactly one path between any two open squares, so the treasure and the exit can always be reached.

Controls

8
move up
2
move down
4
move left
6
move right
666
type several moves at once, then press enter; the duck stops at the first wall
Q
quit the round and go back to the menu

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. # DUCKMAZE 1.0 - DuckieDai (TM)
  2. # TI-84 Plus CE Python Edition
  3. from random import randrange
  4. W=13
  5. H=7
  6. def pause():
  7. input('Enter ')
  8. def intro():
  9. print('DUCKMAZE')
  10. print(' __')
  11. print(' ___(o )> quack!')
  12. print(' \\ <_. )')
  13. print(" `---'")
  14. print('DuckieDai (TM)')
  15. print('hiddenwordscanner.com')
  16. pause()
  17. def maze():
  18. # 13x7 perfect maze: DFS on 6x3 room cells.
  19. g=[['#']*W for i in range(H)]
  20. stack=[(1,1)]
  21. g[1][1]=' '
  22. while stack:
  23. x,y=stack[-1]
  24. moves=[]
  25. for dx,dy in ((2,0),(-2,0),(0,2),(0,-2)):
  26. nx=x+dx;ny=y+dy
  27. if 0<nx<W-1 and 0<ny<H-1 and g[ny][nx]=='#':
  28. moves.append((nx,ny,dx,dy))
  29. if moves:
  30. nx,ny,dx,dy=moves[randrange(len(moves))]
  31. g[y+dy//2][x+dx//2]=' '
  32. g[ny][nx]=' '
  33. stack.append((nx,ny))
  34. else:
  35. stack.pop()
  36. return g
  37. def draw(g,x,y,steps,found,msg):
  38. # 10 lines with the prompt, so the
  39. # whole maze fits on one screen.
  40. print('\n'*3)
  41. print('Steps '+str(steps)+' Treasure '+str(found)+'/1')
  42. for j in range(H):
  43. line=''
  44. for i in range(W):
  45. line+='D' if (i==x and j==y) else g[j][i]
  46. print(line)
  47. print(msg if msg else 'D you T treasure E exit')
  48. def play(best):
  49. g=maze()
  50. # Exit is far end; treasure placed on another random corridor.
  51. g[H-2][W-2]='E'
  52. spots=[]
  53. for j in range(1,H-1):
  54. for i in range(1,W-1):
  55. if g[j][i]==' ' and (i,j)!=(1,1):
  56. spots.append((i,j))
  57. tx,ty=spots[randrange(len(spots))]
  58. g[ty][tx]='T'
  59. x=y=1
  60. steps=0
  61. found=0
  62. msg=''
  63. while True:
  64. draw(g,x,y,steps,found,msg)
  65. msg=''
  66. c=input('Move 8/2/4/6 Q? ').strip().upper()
  67. if c=='Q':
  68. print('Game ended.')
  69. pause();return best
  70. # Several moves at once: 666 goes
  71. # right 3 times, stopping at a wall.
  72. ok=c!=''
  73. for k in c:
  74. if k not in '8246':ok=False
  75. if not ok:
  76. msg='Use 8 2 4 6, or Q'
  77. continue
  78. for k in c:
  79. dx=dy=0
  80. if k=='8':dy=-1
  81. elif k=='2':dy=1
  82. elif k=='4':dx=-1
  83. else:dx=1
  84. nx=x+dx;ny=y+dy
  85. if not (0<=nx<W and 0<=ny<H) or g[ny][nx]=='#':
  86. msg='Wall!'
  87. break
  88. x=nx;y=ny;steps+=1
  89. if g[y][x]=='T':
  90. found=1
  91. g[y][x]=' '
  92. msg='Treasure found!'
  93. if g[y][x]=='E':
  94. if found:
  95. if best==0 or steps<best:best=steps
  96. print('\n'*3)
  97. print('YOU ESCAPED!')
  98. print('Moves: '+str(steps))
  99. print('Best: '+str(best))
  100. print('QUACK WIN!')
  101. pause();return best
  102. msg='Find treasure first!'
  103. def help_page():
  104. print('\n'*3)
  105. print('FIND TREASURE (T)')
  106. print('THEN EXIT (E)')
  107. print('D = you, # = wall')
  108. print('8 up, 2 down')
  109. print('4 left, 6 right')
  110. print('666 = right 3 times')
  111. print('Q = quit round')
  112. pause()
  113. def main():
  114. intro()
  115. best=0
  116. while True:
  117. print('\n'*3)
  118. print('DUCKMAZE')
  119. print('1 Play')
  120. print('2 Help')
  121. print('3 Exit')
  122. c=input('Choice? ').strip()
  123. if c=='1':best=play(best)
  124. elif c=='2':help_page()
  125. elif c=='3':
  126. print('DuckieDai (TM)')
  127. print('hiddenwordscanner.com')
  128. return
  129. else:print('Choose 1-3')
  130. main()
Filename
DUCKMAZE.py
Size
2888 bytes
SHA-256
adc103680cde2d3db8e7b3cca1ec3271093c850e3c7812d9ac90e28eec522cba

Usage

Inputs

  • 1, 2, or 3 at the menu: Play, Help, or Exit
  • One or more moves such as 6 or 6622, then enter
  • Q to quit the round

Outputs

  • The maze with D for you, T for the treasure, E for the exit, and # for walls, with the step count
  • Wall!, Treasure found!, or Find treasure first! under the maze
  • YOU ESCAPED! with the moves taken and the best (fewest) moves this session

Units: Maze squares; no units.

Assumptions and limitations

Assumptions

  • Each round digs a new random 13 by 7 maze with exactly one path between any two open squares.
  • You start in the top-left corner and the exit is always in the bottom-right corner; the treasure is on a random open square.

Constraints

  • Moves are typed with the number keys 8 (up), 2 (down), 4 (left), and 6 (right); several can be typed at once, such as 666.
  • A move string with any other character, or an empty answer, makes no move and shows Use 8 2 4 6, or Q.

Known failures

  • The exit only opens after the treasure is found; walking onto it first shows Find treasure first!
  • The best score resets 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 for this exact file, played after this release changed it to fit the calculator screen: a wider maze, messages kept under the maze, several moves typed at once, and a best score. The owner's original also passed before the changes.
Dependencies
random
Suggested calculator name
DUCKMAZE — 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 DUCKMAZE 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.