Skip to content

Instantly share code, notes, and snippets.

@olaugh
Created September 9, 2009 21:43
Show Gist options
  • Save olaugh/184106 to your computer and use it in GitHub Desktop.
Save olaugh/184106 to your computer and use it in GitHub Desktop.
(in-package #:ouat)
(defun jqxz+1-stems ()
(let ((racks-that-bingo-through-jqxz
(unique
(loop
for big-tile across "JQXZ"
for ana-pattern = (format nil "~a???????" big-tile)
append (steal-tiles ana-pattern))))
(jqxz+1-stems nil))
(dolist (rack racks-that-bingo-through-jqxz)
(let ((ana-pattern (format nil "~a?" rack)))
(multiple-value-bind (words blanks)
(anagram-stem ana-pattern)
(when (and (= 2 (length words))
(string/= (first blanks)
(second blanks)))
(push rack jqxz+1-stems)))))
jqxz+1-stems))
(defun woadwage-bingos (n)
(let ((bag (coerce *scrabble-bag* 'list)))
(labels ((draw-random-rack ()
(coerce (subseq (shuffle bag) 0 7) 'string)))
(loop
for i below n
for rack = (draw-random-rack)
count (woadwage rack)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment