Anyway, I'm in the midst of writing one for my own educational purpose, interest and for a bunch of friends in my irc channel.
Here's the gist of it
Code: Select all
set die(0) "lrytte"
set die(1) "vthrwe"
set die(2) "eghwne"
set die(3) "seotis"
set die(4) "anaeeg"
set die(5) "idsytt"
set die(6) "oattow"
set die(7) "mtoicu"
set die(8) "afpkfs"
set die(9) "xlderi"
set die(10) "hcpoas"
set die(11) "ensieu"
set die(12) "yldevr"
set die(13) "znrnhl"
set die(14) "obbaoj"
set die(15) "nmihuq"
proc generateboggle {bog} {
global die
set letters ""
set numbers ""
set randnum ""
while { [llength $letters] < 16 } {
set foundadupe 0
set randnum [rand 16]
set counter 0
while {$counter < [llength $numbers]} {
set dupenumtocheck [lrange $numbers $counter $counter]
if {$dupenumtocheck == $randnum} {
set foundadupe 1
}
incr counter
}
if {$foundadupe == 0} {
lappend numbers $randnum
set randletter [string index $die($randnum) [rand 6]]
lappend letters $randletter
}
}
return $letters
}
proc Boggle {nick uhost hand chan args} {
global bog
set bogstring [generateboggle $bog]
putquick "privmsg #Boggle :[join [split [lrange $bogstring 0 3] " "] " "]"
putquick "privmsg #Boggle :[join [split [lrange $bogstring 4 7] " "] " "]"
putquick "privmsg #Boggle :[join [split [lrange $bogstring 8 11] " "] " "]"
putquick "privmsg #Boggle :[join [split [lrange $bogstring 12 15] " "] " "]"
utimer 360 "EndofRound #Boggle"
}
The boggle solver will generate a list of all the possible words based on a dictionary text file.
The eggdrop will then match the answers typed in by the players against this list.
The Boggle solver was obtained from here
Ideally, I would like to convert the C code into tcl, but my knowledge in C is pretty limited.
Anyway, I would like to know how to use the egg to feed the letters into the Solver. To run the solver, I have to type ./boggle2 and press enter. Then I have to type the letters on the boggle board one by one, pressing enter after each one.
After all the letters have been entered, the solver will print the list of words on the console screen. I need to change it to print to a text file.
I think I should be able to manage the matching of answers to the text file after this. Hopefully!
Any comments/advice/suggestions will be greatly appreciated!