Skip to content

Yselessia/Ladders-Assignment-4

Repository files navigation

Ladders Assignment 4

"word ladders" puzzle game

Made between 21/01/2026 and 02/03/2026 by Ruth Lindsay

Necessary installs: Python, tkinter, TkGifWidget, nltk.stem

Player instructions

First, enter a word as your target. You're going to try to get to this from the start word. Each turn, you can change one letter to make a new word. Try to get to the target in as few turns as possible. When you get there, you'll see your score - the lower the score the better!

Sources used

Victory gif: https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExMGJjdjd3bHExMWJla21yd2w2YXBoYm52eGpwNjFoZ2UzYXZtMHV6eSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/vNg7NlqbP7IcybItRI/giphy.gif

Word list (via Natural Language Toolkit words corpora): English, http://en.wikipedia.org/wiki/Words_(Unix)

AI use

https://copilot.microsoft.com/shares/41bvbwcqKaunBxa1m5pPy

^does not exist. how long does a share link last...? oops. Used Copilot to generate a tkinter gui with a grid on entry-boxes

https://copilot.microsoft.com/shares/admTpDkm1qXsR4BWynohq my prompt: can the cursor move to the next box after one character has been typed? and then we return the full word (one letter per box) multiple functions from previous ai-generated code

https://copilot.microsoft.com/shares/7T7pAemmn9MGcywEzNnQc my prompt: why isn't this working? code snippet

response: If you want full control, you must:

  • Bind to KeyPress, not KeyRelease
  • Handle the key yourself
  • Return "break" to stop Tkinter from doing its own insert/delete Here’s the corrected pattern: ...

https://copilot.microsoft.com/shares/kz6jwrtVQVSfoRkMPjM7k my prompt: what method do i use to add a row without clearing the text from the entry widgets?

def add_row(self):
        self.build_grid(self.rows + 1, self.cols)
def build_grid()...

response: copilot suggested moving the widget creation loop into the add_row function. I copied the code, but changed the logic for row index as it was bugging

https://copilot.microsoft.com/shares/Z4LgWFEnYPVPxWV6SXNau asked copilot about control flow logic, provided code snippets from on_key() and Puzzle class (word = self._interactions.get_word(length=self._len))

https://copilot.microsoft.com/shares/Vx6x6hLi5sQwtihR6ekVz asked copilot about callback functions: my word processing is equivalent to a user turn. would i put self._interactions.on_submit(self.user_turn) at the end of the user_turn function? will this mess with memory limit/callstack

essentials of response: The call stack doesn’t grow (callbacks aren’t recursive), but the number of registered listeners does (...) You just let user_turn handle the game state:

def user_turn(self, word):
    if self.state == "waiting_for_guess":
        self.handle_guess(word)
    elif self.state == "waiting_for_confirmation":
        self.handle_confirmation(word)
    # etc.

I implemented the suggestions, keeping the majority of logic in user_turn but adding a function to handle user input -*

https://copilot.microsoft.com/shares/hyQnGczzxsgGkFYPZVB6J https://copilot.microsoft.com/shares/gtUssk3z22uJvCxEsrzjw asked copilot about unexpected row behaviour when I tried to to insert rows to the grid

essentials of response: You are mixing two different row systems:

What you think is happening What Tkinter is actually doing
What you think is happening What Tkinter is actually doing
self.entries controls the grid .grid(row=...) controls the grid
Inserting into self.entries shifts rows Tkinter does not shift grid rows
Row 0 stays row 0 Row 0 gets overwritten

copilot then generated a function, regrid_last_two_rows, which I added to my code as well as modifying add_row

pasted a tkinter error readout into copilot. response: self (the entry widget) has already been destroyed

https://chatgpt.com/s/t_699f0f815e688191b25c242581906cc3

About

"word ladders" puzzle game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages