Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feature request: briefly flash newly guessed word in different color #1

@oantolin

Description

@oantolin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions