Giter Site home page Giter Site logo

hoyathali / wordladderai Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 47 KB

The Word Ladder Game is a classic word puzzle where players transform one word into another by changing only one letter at a time, ensuring each intermediate step is a valid word. The game encourages students to implement custom search algorithms.

Python 100.00%
bfs dfs word-ladder

wordladderai's Introduction

Word Ladder Game

Overview

The Word Ladder Game is a classic word puzzle where the challenge is to transform one word into another, changing only one letter at a time, with the constraint that every intermediate step is also a valid word. This implementation provides a graphical user interface (GUI) for users to play and visualize the game.

Getting Started

To run the Word Ladder Game, you need to have Python and the Tkinter library installed. If not, you can install Tkinter using:

pip install tk

After installing Tkinter, you can run the game with:

python main.py

How to Play

  1. Enter Start and Target Words: Input the starting and target words in the provided text fields.

  2. Choose Search Algorithm: Click the "BFS" button to use Breadth-First Search or the "DFS" button to use Depth-First Search. Additionally, there are "BFS Impl" and "DFS Impl" buttons that are intended for students to implement their custom search algorithms.

  3. View Results: The game will display the word ladder from the start word to the target word. The "Nodes Expanded" label shows the number of nodes visited during the search.

  4. image

  5. Try Different Words: You can enter new start and target words and choose a different search algorithm.

Custom Search Algorithm Implementation

Implementing bfs_impl_search and dfs_impl_search

For students working on the custom search algorithms, they need to implement the following functions:

  • bfs_impl_search(word_list): Perform Breadth-First Search on the given word_list to find the word ladder. Return the word ladder and the number of nodes expanded.

  • Please check bfs_impl_search.py for more details

  • dfs_impl_search(word_list): Perform Depth-First Search on the given word_list to find the word ladder. Return the word ladder and the number of nodes expanded.

  • Please check dfs_impl_search.py for more details

Tips for Implementation

  • Useful Structures: Utilize Python data structures like queues and stacks for BFS and DFS, respectively.

  • Efficient Word Generation: When generating neighbours of a word, ensure efficiency by considering only valid words in the dictionary.

  • Visited Nodes: Keep track of visited nodes to avoid redundant exploration.

  • Termination Condition: Implement a termination condition when the target word is found.

Example

Here is an example structure for your bfs_impl_search and dfs_impl_search:

def bfs_impl_search(self,word_list):
    # Implement BFS here
    pass

def dfs_impl_search(self,word_list):
    # Implement DFS here
    pass

Feel free to explore and experiment with different strategies to optimize the search process.

Acknowledgments

This Word Ladder Game is inspired by classic word puzzles. Special thanks to the developers and contributors who made the project possible.


wordladderai's People

Contributors

hoyathali avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.