Giter Club home page Giter Club logo

jumblr's Introduction

Commentary:

Provides a function `jumblr-new-game’ (aliased to `jumblr’) which launches a word game closely based on the old TextTwist by Yahoo.

The interface should be pretty intuitive: it displays a sequence of letters, along with a series of blanks. The blanks represent words which can be made from the letters. You type a word and “submit” it by either hitting SPC or RET; the word replaces one of the blanks if it fits. Hitting SPC or RET with an empty guess reshuffles the letters.

I tried to make the interface pretty responsive; take a look at the screenshots below for a sense of how it works

./screenshots/jumblr-normal.png

Typing:

./screenshots/jumblr-typing.png

If you give up and ask for the solution:

./screenshots/jumblr-solve.png

Notes about the implementation:

The implementation is pretty straightforward and mostly consists of functions to find permutations and subsets of words; I’m sure this could be made much faster.

The most important aspect for game play is actually the word list: in order for the game to be fun it must know all the words you can think of, but not have too many obscure words. It turns out to be surprisingly difficult to find that balance. My approach is as follows:

  1. Take the SIL english word list and intersect it with the New Oxford English Dictionary which comes with mac osx. I then removed the three letter words which were obviously acronyms, abbreviations for longer words, or racial slurs. This is the “expert” word list and contains about 85,000 words. (source: http://www-01.sil.org/linguistics/wordlists/english/)
  2. Take the “8” word list from http://www.keithv.com/software/wlist/ and intersect it with the “expert” list. This becomes the “hard” list and contains about 47,000 words.
  3. Take the “9” word list from the above link and intersect with with the “expert” list. This is the “medium” list and contains about 36,000 words.
  4. Take the “10” word list from the above link and intersect it with the “expert” list. This contains 21,000 words and is the “easy” list.

Let me know how you find the difficulty levels – I’d really appreciate the feedback!

Installation:

Use package.el. You’ll need to add MELPA to your archives:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

Alternatively, you can just save this file and do the standard

(add-to-list 'load-path "/path/to/jumblr.el")
(require 'jumblr)

Customization:

See the defvar definitions at the beginning of the source code. For example, to switch the dictionary, add the following to your .emacs:

(setq jumblr-dict-file "dict/easy.txt")

Acknowledgements

Thanks to Meredith, Brittany, Kathara, and Anna for suggesting the name jumblr!

jumblr's People

Contributors

mkmcc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jumblr's Issues

Feature request: briefly flash newly guessed word in different color

Great game, thanks for writing it!

When playing with a large list of words, I have a hard time telling if I've guessed a new word or simply retyped I word I already had. It would help to have a newly guessed word appear in a different color. I guess strictly speaking knowing I really got a new word is unnecessary, but it's reassuring.

Here's a very hacky way to implement the change: when a correct guess is made, instead of putting (word t) in the data structure, mark it differently, say as (word new), then when drawing that entry use a different face and change the symbol new to t so on the next redrawing it will appear in jlr-correct-face. Here's a diff:

diff -c your-jumblr.el modified-jumblr.el
*** your-jumblr.el      2015-01-09 11:15:37.899773390 -0500
--- modified-jumblr.el  2015-01-09 11:00:49.907370068 -0500
***************
*** 130,135 ****
--- 130,136 ----
  ;;; faces
  (make-face 'jlr-scrable-face)
  (make-face 'jlr-correct-face)
+ (make-face 'jlr-flash-face)
  (make-face 'jlr-cheat-face)
  (make-face 'jlr-blank-face)
  (make-face 'jlr-guess-face)
***************
*** 140,145 ****
--- 141,152 ----
                      :foreground "#859900"
                      :height 1.5)

+ (set-face-attribute 'jlr-flash-face nil
+                     :inherit 'fixed-pitch
+                     :weight 'bold
+                     :foreground "#008599"
+                     :height 1.5)
+ 
  (set-face-attribute 'jlr-blank-face nil
                      :inherit 'fixed-pitch
                      :height 1.5)
***************
*** 375,380 ****
--- 382,390 ----
        (cond
         ((equal -1 status)
          (propertize output 'face 'jlr-cheat-face))
+        ((equal 'new status)
+         (setcdr elt '(t))
+         (propertize output 'face 'jlr-flash-face))
         (status
          (propertize output 'face 'jlr-correct-face))
         (t
***************
*** 428,434 ****
      (when (-contains? data try)
        (let ((ind (-elem-index try data)))
          (setq data (remove try data))
!         (setq data (-insert-at ind (list word t) data))))
      (setq jlr-game-data
            (list (list (jlr-scramble-word scr) "")
                  data))))
--- 438,444 ----
      (when (-contains? data try)
        (let ((ind (-elem-index try data)))
          (setq data (remove try data))
!         (setq data (-insert-at ind (list word 'new) data))))
      (setq jlr-game-data
            (list (list (jlr-scramble-word scr) "")
                  data))))

Diff finished.  Fri Jan  9 11:16:45 2015

This seems very undisciplined and I'm sure if you wanted to implement this feature you'd find a better way to do it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.