Ticket #16 (new enhancement)

Opened 3 months ago

azgame, shiritori and other (future) word games should share a common word list

Reported by: trejkaz Assigned to: oblomov
Priority: normal Milestone:
Component: plugins Version: git
Severity: normal Keywords:
Cc:

Description

azgame has a word list which is relatively forwards-compatible (in that new words will become available immediately, although if the site it queries goes down it can't be helped) whereas shiritori requires dropping in a valid words file.

It would be nice of the two could share the list to reduce the hassle when a missing word is found (currently you update one list, and then later discover it was missing from the other one.)

It would be nice to have something like this to be used from plugins...

class WordList
  ## Tests if a word is in the list.
  def included?(word); ... end

  ## Selects a random word
  def pick_random; ... end

  ## Gets a count of the number of internally known words.
  ## If this is a network-based word list then it will be the number of cached words, not the total valid words.
  def word_count; ... end
end

So then you could have FileBasedWordList?, OxfordOnlineCachedWordList?, etc. Or one which delegates to the dict or dictclient plugin...

For Japanese games like Shiritori you could potentially have a base wordlist class which has the real word list in it, and then shiritori.rb could define a list which prohibits words ending in ん before delegating to the real word list.

I don't know if the right way to do this is to write a wordlist plugin and then make other plugins depend on that one... or whether it's better to make it a module which you mix into wordlist-based games. Was there a proper place to put files which need to be included from plugins?