2048: allow configuration via Customize
This commit is contained in:
parent
5bf12a119f
commit
dcff4255f7
42
lisp/2048.el
42
lisp/2048.el
@ -35,18 +35,33 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'dash)
|
||||
(defvar 2048--cell-width 6
|
||||
"Width of number cells for 2048. Should be at least 4 to fit \"2048\".")
|
||||
(defvar 2048--board-size 4
|
||||
"Number of tiles on the board for 2048. 4 is the default.")
|
||||
|
||||
(defvar 2048--vertical-sep-char ?│
|
||||
"Character to use as a vertical border for 2048 cells.")
|
||||
(defvar 2048--horizontal-sep-char ?─
|
||||
"Character to use as a horizontal border for 2048 cells.")
|
||||
(defvar 2048--corner-sep-char ?+
|
||||
"Character to use as the intersection between `2048--vertical-sep-char'
|
||||
and `2048--horizontal-sep-char'.")
|
||||
(defgroup 2048 nil
|
||||
"Play a game of 2048."
|
||||
:prefix "2048--"
|
||||
:group 'games)
|
||||
(defvar 2048--cell-width 6
|
||||
"Width of number cells for 2048. Should be at least 4 to fit \"2048\".
|
||||
|
||||
Values other than 6 are not currently supported.")
|
||||
(defcustom 2048--board-size 4
|
||||
"Number of tiles on the board for 2048. 4 is the default. Can be any number."
|
||||
:type 'integer
|
||||
:group '2048)
|
||||
|
||||
(defcustom 2048--vertical-sep-char ?│ ; 9478
|
||||
"Character to use as a vertical border for 2048 cells."
|
||||
:type 'character
|
||||
:group '2048)
|
||||
(defcustom 2048--horizontal-sep-char ?─ ; 9472
|
||||
"Character to use as a horizontal border for 2048 cells."
|
||||
:type 'character
|
||||
:group '2048)
|
||||
(defcustom 2048--corner-sep-char ?+
|
||||
;; ?╬ ; needlessly fancy version
|
||||
"Intersection of `2048--vertical-sep-char'and `2048--horizontal-sep-char'."
|
||||
:type 'character
|
||||
:group '2048)
|
||||
|
||||
(defun 2048--make-sep-times (delimiter filler cells cellwidth)
|
||||
"Return a string of CELLS number of cells, each with width CELLWIDTH.
|
||||
@ -58,11 +73,10 @@ The cells consist of FILLER and are separated by DELIMITER."
|
||||
(concat (flatten-tree (list delimiter almost-done-list)))))
|
||||
;; (2048--make-sep-times ?> ?- 5 2)
|
||||
|
||||
(setq 2048-plus-sep (2048--make-sep-times
|
||||
(defvar 2048-plus-sep (2048--make-sep-times
|
||||
2048--corner-sep-char 2048--horizontal-sep-char
|
||||
;; ?╬ ?─ ; needlessly fancy version
|
||||
2048--board-size 2048--cell-width))
|
||||
(setq 2048-space-sep (2048--make-sep-times
|
||||
(defvar 2048-space-sep (2048--make-sep-times
|
||||
2048--vertical-sep-char (string-to-char " ")
|
||||
2048--board-size 2048--cell-width))
|
||||
(defun 2048--pad (number)
|
||||
|
Loading…
Reference in New Issue
Block a user