On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Hmm I have a reference to something in the yawl module I feel like might just be a file of all the words (words.lisp)

(+1)

Anyway I changed *valid-word* (I guess just wanting an asdf system is the previous version) to

(defvar *valid-words*
 (let ((ht (make-hash-table :test 'equal)))
  (loop for word in (apply 'append *bucketed-words*)
   do (setf (gethash word ht) t))))

(Yes I know, but there aren't that many words.).

Then I was able to

$ rlwrap ecl
> (require "thirteen-words")
> (13l:menu)

Also I missed that the game is that every wrong guess reveals a character. I thought you were asking me to just unscramble thirteen letters cold. So I

(defun delete-1st (ch list)
 (let ((idx (search `(,ch) list))
  (cond ((null idx) list)
   (= idx (1- (length list)) (butlast list))
   (t (append (subseq list 0 idx) (subseq list (1+ idx))))))
(defun word-has (word letters)
 (loop for lord = (coerce word 'list) then (delete-1st ch lord)
  for ch across letters
  when (not (member ch lord)) do (return-from word-has nil))
 (list word))
(defun cheat (letters)
 (loop for word in (apply 'append *bucketed-words*) nconc (word-has word letters)))

;p my score is very good...

(+1)

Ah, I broke the console version while making the web one. Sorry about that!

I think it would work if you synced the Git sub module (something I should add to the instructions). But fortunately for you *valid-words* is only used on the web server, so even just making it nil should make the console game run 🙂


Thanks for giving it a spin!

Aha, I simply saw it was being used elsewhere in my glance over the codes and tried to hackily fulfill its spirit.

You are far more patient with broken code than I am 🙂

(+1)

I feel like there's gotta be a suitable data structure that does 'member that looks like 'member and not 'gethash as well. I'll ask people on my show, they're smart ;p

(+1)

I didn't see anything built-in, although it looks like there is at least one library: https://github.com/samebchase/hash-set/

I guess the idiom is most of the time to just use 'member. 'member will be O(b . n) for very small b, whereas using a hashtable with no collisions will be O(c . 1) for very large c. And maybe there are collisions, so <hash table collision complexity>