Aurebesh typing test for emacs

This entry is part 3 of 3 in the series Aurebesh

A few weeks ago, I posted the Aurebesh typing test. Since I’ve recently started learning elisp, I figured that I should implement the typing test as a feature for emacs.

The code below is terrible with bugs and problems, but heck, it’s my first elisp program after all. My goal is to improve the version over time and to add features such as logging results in a separate file and displaying a progress statistic. To use it, you’ll need to first install the Aurebesh font.

(setq correct 0)
(setq wrong 0)
(setq seconds-left 60)
(setq test-start t)

(require 'widget)

(defun aurebesh-typing-test ()
  "Aurebesh typing test"
  (get-buffer-create "*Aurebesh typing test*")

(defun custom/reset-aurebesh-typing-test-vars()
  (setq test-start t)
  (setq correct 0)
  (setq wrong 0)
  (setq seconds-left 60))

(defun custom/aurebesh-typing-test()
  (with-current-buffer "*Aurebesh typing test*"
    (insert "Correct / wrong answers: " (number-to-string correct) " / " (number-to-string wrong) " \n")

(defun custom/setup-buffer()
  (let ((inhibit-read-only t))

(defun custom/refresh-seconds()
    (goto-line 1)
    (insert "Seconds: " (number-to-string seconds-left) "\n")))

(defun custom/delete-line()
  (let ((beg (point)))
    (forward-line 1)
    (delete-region beg (point))))

(defun custom/create-line-with-widget()
  (if (> seconds-left 0)
      (setq randomChar (custom/get-random-char))
    (setq randomChar ""))
  (widget-insert randomChar)
  (widget-insert "\t")
  (widget-create 'editable-field
		 :size 15
		 :correct (string randomChar)
		 :notify 'custom/check-input-value)
  (widget-insert "\n"))

(defun custom/setup-widget()
  (use-local-map widget-keymap)
  (widget-forward 1))

(defun custom/set-aurebesh()
  "Sets the aurebesh font in current buffer"
  (setq buffer-face-mode-face '(:family "Aurebesh"))

(defun custom/check-input-value(widget &rest ignore)
  "Compare aurebesh input character with requested one."
     (widget-get widget :correct)
     (widget-value widget))
    (custom/correct-input widget))
   ((not(= (length (widget-value widget)) 0))

(defun custom/correct-input(widget)
  (if test-start
	(setq test-start nil)))
  (if (> seconds-left 0)
	(setq correct (+ correct 1))
	(custom/next-character widget))))

(defun custom/start-timer()
  "Start Aurebesh test"
  (setq seconds-left 60)
  (setq timer (run-with-timer 0 1 'custom/decrement-seconds)))

(defun custom/decrement-seconds()
  (with-current-buffer "*Aurebesh typing test*"
    (if (> seconds-left 0)
;	(progn
	  (setq seconds-left (- seconds-left 1))
;	  (custom/refresh-seconds)
;	  (widget-forward 1))

(defun custom/stop-aurebesh-typing-test()
  (with-current-buffer "*Aurebesh typing test*"
  (cancel-timer timer)

(defun custom/set-arial()
   "Sets the arial font in current buffer"
   (setq buffer-face-mode-face '(:family "Arial"))

(defun custom/next-character(widget)
  (with-current-buffer "*Aurebesh typing test*"
    (custom/fill-random-character widget)
    (widget-forward 1)

(defun custom/fill-random-character(widget)
    (goto-line 2))
  (delete-char 1)
  (if (> seconds-left 0)
      (setq randomChar (custom/get-random-char))
    (setq randomChar ""))
  (widget-insert randomChar)
  (widget-put widget :correct (string randomChar))
  (widget-value-set widget ""))

(defun custom/get-random-char ()
  "Insert a random alphanumeric character.."
  (let ((mycharset "abcdefghijklmnopqrstyvwxyz"))
    (elt mycharset (random (length mycharset)))))

(defun custom/fill-correct-wrong-answers()
    (goto-line 3))
  (insert "Correct / wrong answers: " (number-to-string correct) " / " (number-to-string wrong) " \n"))
(defun custom/wrong-input()
  (message "%s" (widget-get widget :correct))
  (widget-value-set widget "")
  (setq wrong (+ wrong 1)))

Aurebesh typing test

This entry is part 2 of 3 in the series Aurebesh

Just a bit more than a week ago, I wrote a post about me learning Aurebesh. I’m still far from proficient, but I continue practicing and, even more important, enjoying it. As mentioned in the one post, I’m using a few online tools to practice and after using Patrick Lambert’s timed translation tool for a bit, I felt like writing my own version with slight changes.

I really like Patrick’s little utility, since it gives you a nice and quick progress feedback. After using it for a bit, I could think of a few improvements. I, for example, don’t quite like that I have to press enter after each character. I consider that redundant and it makes my result count lower than it could be. Furthermore, his implementation continues with a new random character even if the user input was wrong. I prefer being stuck with an Aurebesh character till the correct input has been provided.

After writing my own little version and trying it out, I figured that it would be nice if I saw the number of wrong inputs as well. After all, a high number of correct inputs looks great, but if the number of incorrect inputs is high as well, it kind of diminishes the success.

I hope you find the little Aurebesh typing test feature useful. Please let me know if you can think of something to improve it even more.

Aurebesh typing test

Seconds left:

Correct/Wrong answers:
A(a) B(b) C(c) D(d) E(e) F(f) G(g) H(h) I(i)
J(j) K(k) L(l) M(m) N(n) O(o) P(p) Q(q) R(r)
S(s) T(t) U(u) V(v) W(w) X(x) Y(y) Z(z)


This entry is part 1 of 3 in the series Aurebesh

A few days ago, I decided to study Aurebesh. What the banana is Aurebesh? Aurebesh is a made up writing system. It appeared first in Star War’s ‘Return of the Jedi’. If you’re interested in learning more about its history, I strongly recommend you read Wookieepedia.


The force is strong with this young Padawan

For sure, you now think I’m a major Star Wars fan. Let’s just say, I enjoy the movies and I love the books written by Drew Karpyshyn. If somebody asks me, what I prefer more, Star Trek or Star Wars, I’ll answer without hesitation Star Trek.

So why am I learning that made up writing system? First of all, it’s easy to learn. It is basically English with different letters. So I don’t actually learn a new language. You could argument that it’s useless studying those letters. Maybe, but I think it’s cool being able to read articles in Aurebesh.

I am using several links to improve my reading. I use the timed translation at least once a day to measure my progress. I’m currently at 43 characters a minute (not very impressive, I know). Additionally, I exercise reading at least 10 minutes a day with the Aurebesh trainer. Last but not least, I downloaded the font, installed it on my machine and then set Firefox’s default font to Aurebesh. I wonder how long it will take me till I can use the browser with that font setting through out the day. For now, I limit myself to one short news article a day.

This is a new day, a new beginning.

As you can see, I also got the Aurebesh font plugin for WordPress from Jeremy Duenas. Now I can add here and there a saying to my blogs and only a few people will be able to read it.