PHP Classes

File: custom_word_solver.php

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Word Solver  >  custom_word_solver.php  >  Download  
File: custom_word_solver.php
Role: Example script
Content type: text/plain
Description: Example using custom dictionary
Class: Word Solver
Generate words or anagrams from specified rules
Author: By
Last change:
Date: 10 years ago
Size: 1,528 bytes


Class file image Download
 * This script is developed by Arturs Sosins aka ar2rsawseen,
 * Feel free to distribute and modify code, but keep reference to its creator
 * Word Solver class can generate words or anagrams using provided rules, for example,
 * possible letters, placement of specific letter, which letters should be used together,
 * or using any character from specified alphabet.
 * This class can be used to generate solutions to scrabble, crosswords, anagrams
 * and other word games.
 * For more information, examples and online documentation visit:
class custom_word_solver extends word_solver
    //initialize dictionary
protected function dictionary_init(){
$str = file_get_contents("./custom_dictionary.txt");
$parts = explode("\r\n", $str);
$parts as $part)
$this->dict[mb_strtolower($part)] = true;
//return false if word is incorrect
    //or true if word is correct
protected function dictionary_check($word){
$ret = false;
strlen($word) > 2)
$ret = true;

For more information send a message to info at phpclasses dot org.