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
Tried it? Did this program work on your calculator?
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.
TI-84 Plus CE Python · screen preview
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
- Press enter at the opening screen, then type 1 to play. Type 2 at the menu to see the help screen.
- The maze shows your steps so far and whether you have the treasure. You start in the top-left corner.
- Type a move, or a string of moves such as 6622, and press enter. Each square you move counts as one step.
- Bumping a wall shows Wall! and stops the moves you typed after it, without costing a step.
- Walk onto the T to pick up the treasure, then reach the E. Getting there first shows Find treasure first!
- Escape to see your moves and your best (fewest) moves this session, then press enter to go back to the menu.
Tips
- The number keys are laid out like arrows: 8 is above 2, with 4 on the left and 6 on the right.
- Typing a whole corridor at once, such as 6666, saves pressing enter for every square.
- Look at where the treasure is before you move. The fastest route often passes the exit on the way, which is fine: just keep going.
- Dead ends are common. If a corridor stops, back up to the last place it split and try the other way.
Good to know
- The best score starts over each time you run the program, and every maze is different, so some rounds need more moves than others.
- Q ends the round without a win; type 3 at the menu to leave the program.
- To stop the game at any time, press the [on] key. The Python App returns to the shell.
Exact reviewed bytes
Source code
# DUCKMAZE 1.0 - DuckieDai (TM)# TI-84 Plus CE Python Editionfrom random import randrangeW=13H=7def pause():input('Enter ')def intro():print('DUCKMAZE')print(' __')print(' ___(o )> quack!')print(' \\ <_. )')print(" `---'")print('DuckieDai (TM)')print('hiddenwordscanner.com')pause()def maze():# 13x7 perfect maze: DFS on 6x3 room cells.g=[['#']*W for i in range(H)]stack=[(1,1)]g[1][1]=' 'while stack:x,y=stack[-1]moves=[]for dx,dy in ((2,0),(-2,0),(0,2),(0,-2)):nx=x+dx;ny=y+dyif 0<nx<W-1 and 0<ny<H-1 and g[ny][nx]=='#':moves.append((nx,ny,dx,dy))if moves:nx,ny,dx,dy=moves[randrange(len(moves))]g[y+dy//2][x+dx//2]=' 'g[ny][nx]=' 'stack.append((nx,ny))else:stack.pop()return gdef draw(g,x,y,steps,found,msg):# 10 lines with the prompt, so the# whole maze fits on one screen.print('\n'*3)print('Steps '+str(steps)+' Treasure '+str(found)+'/1')for j in range(H):line=''for i in range(W):line+='D' if (i==x and j==y) else g[j][i]print(line)print(msg if msg else 'D you T treasure E exit')def play(best):g=maze()# Exit is far end; treasure placed on another random corridor.g[H-2][W-2]='E'spots=[]for j in range(1,H-1):for i in range(1,W-1):if g[j][i]==' ' and (i,j)!=(1,1):spots.append((i,j))tx,ty=spots[randrange(len(spots))]g[ty][tx]='T'x=y=1steps=0found=0msg=''while True:draw(g,x,y,steps,found,msg)msg=''c=input('Move 8/2/4/6 Q? ').strip().upper()if c=='Q':print('Game ended.')pause();return best# Several moves at once: 666 goes# right 3 times, stopping at a wall.ok=c!=''for k in c:if k not in '8246':ok=Falseif not ok:msg='Use 8 2 4 6, or Q'continuefor k in c:dx=dy=0if k=='8':dy=-1elif k=='2':dy=1elif k=='4':dx=-1else:dx=1nx=x+dx;ny=y+dyif not (0<=nx<W and 0<=ny<H) or g[ny][nx]=='#':msg='Wall!'breakx=nx;y=ny;steps+=1if g[y][x]=='T':found=1g[y][x]=' 'msg='Treasure found!'if g[y][x]=='E':if found:if best==0 or steps<best:best=stepsprint('\n'*3)print('YOU ESCAPED!')print('Moves: '+str(steps))print('Best: '+str(best))print('QUACK WIN!')pause();return bestmsg='Find treasure first!'def help_page():print('\n'*3)print('FIND TREASURE (T)')print('THEN EXIT (E)')print('D = you, # = wall')print('8 up, 2 down')print('4 left, 6 right')print('666 = right 3 times')print('Q = quit round')pause()def main():intro()best=0while True:print('\n'*3)print('DUCKMAZE')print('1 Play')print('2 Help')print('3 Exit')c=input('Choice? ').strip()if c=='1':best=play(best)elif c=='2':help_page()elif c=='3':print('DuckieDai (TM)')print('hiddenwordscanner.com')returnelse:print('Choose 1-3')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
- 1.0.0 — current version, published . Download this reviewed version
Related learning
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.