Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:25:10+00:00 2026-06-06T22:25:10+00:00

im doing research project for a the game Text twist,the text will automatically search

  • 0

im doing research project for a the game Text twist,the text will automatically search word from a dictionary and scramble then, and also process the words to be found automatically using the same concept with this site http://grecni.com/texttwist.php , i also need to provide an algorithm that i will use for my project,and im planning to include this word unscrambler in this web site http://grecni.com/texttwist.php but i dont know what algorithm is possibly use to do the actions done on the website i posted. does any one know what type, or what you call the algorithm used,or can be use that will give the same results, an example of the algorithm will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:25:12+00:00Added an answer on June 6, 2026 at 10:25 pm

    The data structure you want is called a Directed Acyclic Word Graph (dawg)

    There are questions already answered about this:

    Algorithm to get a list of all words that are anagrams of all substrings (scrabble)?

    Writing an algorithm for scrabble

    You could also perhaps implement the levenshtein algorithm which would accomplish pretty much the same result:
    MySQL – Which Hash Algo should I use for this?

    Update:

    After giving myself a challenge to create an example to demonstrate the algorithm ive come up with this, as its from a plugin built for my cms its wrapped in a class but your get the idea there is a demo @ http://cherone.co.uk/scrabble_suggest

    First I created a table with id,word,sorted (word = the actual word, sorted = the word alphabetically sorted like for e.g: aardvark sorted would be aaadkrrv) i just found an english wordlist on the internets.

    The form posts the string and then the string is sorted alphabetically to match 1:1 the sorted column, then the string is split into each character and then queried sequentially till the last character. The functions of interest are str_sort,permute,swap Perhaps its of some interest..

    <?php 
    /**
     * Scrabble solver Plugin this file is "inline" included within the frontController class
     */
    Class plugin{
    
        function __construct($core) {
            $this->core = $core;
            $this->plugin_path = SITE_ROOT.'/core/plugins/'.$this->core->router->action.'/';
            $this->request = explode('/',$this->core->router->request);
            //Assign Page meta tags ect
            $this->core->template->meta_keywords    = 'Text,Twist,Text Twist,word,letter,scrabble,unscrambler,unscramble,word finder,puzzle,anagram,scrabble,cheat,cheater,help,helper,solve,solver,free,php';
            $this->core->template->meta_description = 'Scrabble and Anagram like word solver tool to help unscramble letters and words and cheat at your favorite word puzzle';
            $this->core->template->page_title       = $this->core->template->site_name." - Scrabble and Anagram like word solver";
            $route = (isset($this->request[2])?$this->request[2]:null);
        }
    
        function load(){
            set_time_limit(0);
            $data=array('var'=>$this,'result'=>'','word'=>'','word_sort'=>'');
    
            switch($this->core->router->subaction){
                case "index":
                    $string='';
                    if($_SERVER['REQUEST_METHOD']=='POST'){
                        $string = substr(preg_replace('/[^a-zA-Z]/s', '', trim(strtolower($_POST['letters']))),0,8);
                        $data['word'] = $string;
                        $string = $this->str_sort($string);
                        $data['word_sort'] = $string;
                    }
                    $stringLen = strlen($string);
    
                    $result = array();
                    for($i=2;$i<=$stringLen;$i++){
                        $seq = substr($data['word_sort'],0,$i);
    
                        $rounds = explode('|',$this->permute($seq,0,strlen($seq)));
                        $r=$i;
                        foreach($rounds as $round){
                            $result[$r] = $this->get_words($round,strlen($seq));
                            $r++;
                        }
                    }
    
                    $data['result'] = $result;
    
                    $this->core->template->content_center = $this->core->template->loadContentView(get_class(),$this->core->router->subaction,$data);
                    $this->core->template->content_left   = '';
                    $this->core->template->content_right  = '';
                    break;
    
                case "update":
                    $this->insert_word_lists();
                    header('Location: '.SITE_URL.'/'.$this->core->router->action);
                    die;
                    break;
    
                case "api":
                    header('Content-Type: application/json');
                    echo 'No api for this plugin, perhaps one comming soon. ;p';
                    break;
    
                default:
                    header('Location: '.SITE_URL.'/'.$this->core->router->action);
                    die;
                    break;
            }
        }
    
        //Query Method to search for sequenced alphabetically sorted words.
        private function get_words($word,$stringLen){
            $chars = str_split($word,1);
            $sql = "SELECT DISTINCT `word` FROM `plugin_scrabble_words` WHERE ";
            foreach($chars as $char){
                $sql .=' `sorted` LIKE "%'.$char.'%" AND';
            }
            $sql = trim($sql,'AND');
            $sql .= ' AND LENGTH(sorted) = '.$stringLen;
    
            $statement = $this->core->db->prepare($sql);
            $statement->execute();
    
            $result = $statement->fetchAll(PDO::FETCH_ASSOC);
    
            return $result;
        }
    
        //A Model method for updating the database word list.
        private function insert_word_lists(){
            set_time_limit(0);
            $lists = glob($this->plugin_path."wordlists/*.txt");
            foreach ($lists as $list){
                $words = file($list);
                foreach($words as $word){
                    $word = strtolower(preg_replace('/[^a-zA-Z]/s', '', $word));
                    if($this->sql_check_word($word)===false){
                        $this->sql_put_word($word);
                    }
                }
            }
        }
    
        //A Model method for checking the database specific word.
        private function sql_check_word($word){
            $sql = "SELECT `word` FROM `plugin_scrabble_words` WHERE `word` = :word";
            $statement = $this->core->db->prepare($sql);
            $statement->bindParam(':word', $word, PDO::PARAM_STR);
            $statement->execute();
            $result = $statement->fetchAll(PDO::FETCH_ASSOC);
    
            if(!empty($result)){
                return true;
            }else{
                return false;
            }
        }
    
        //A Model method for adding the word to the database.
        private function sql_put_word($word){
            $sql = "INSERT into `plugin_scrabble_words` (word,sorted) VALUES (:word,:sorted)";
            $statement = $this->core->db->prepare($sql);
            $sorted = $this->str_sort($word);
            $statement->bindParam(':word', $word, PDO::PARAM_STR);
            $statement->bindParam(':sorted', $sorted, PDO::PARAM_STR);
            $statement->execute();
        }
    
    
        //Sort Method that will sort a sring in alphabetical order
        private function str_sort($string) {
            $tmp = str_split($string);
            sort($tmp);
            return implode('',$tmp);
        }
    
        //Method to generate and return all permutations of the string with | delimiter.
        private function permute($str,$i,$n) {
            if ($i == $n){
                return $str.'|';
            } else {
                for ($j = $i; $j < $n; $j++) {
                    $this->swap($str,$i,$j);
                    $this->permute($str, $i+1, $n);
                    $this->swap($str,$i,$j);
                }
            }
        }
    
        //Method to swap the char at pos $i and $j of $str.
        private function swap(&$str,$i,$j) {
            $temp = $str[$i];
            $str[$i] = $str[$j];
            $str[$j] = $temp;
        }
    }
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently doing research towards my final year BSc project. The final product will
I'm doing a research project on Image processing. The project is to Evaluate users
I've been doing research on how to enable source analysis for the project I'm
I'm doing a survey of features in preparation for a research project. Name a
Im doing some research for an upcoming project and I am wondering if it
I'm doing background research for a project to write a software tool that converts
I'm doing some research for my project where I'm gone have a shopping cart.
I'm doing some research for a project that I might be doing soon, and
I've been doing some research for a mathematical Android related project I'd like to
I have been doing some research on genetic algorithms for a project in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.