-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstars.el
36 lines (35 loc) · 1.47 KB
/
stars.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(defun insert-stars ()
(let* ((line)
(overlay)
(start (point))
(stars "┼┴├┤┬┴├┤┬└┘┐┌└┘┐┌└┘┐┌└┘┐┌└┘┐┌─────────│││││││││")
(colors '("#4302da" "#5302ca" "#5302ba" "#5302ca"))
(color (nth (random (length colors)) colors))
(pick-char (lambda () (char-to-string (aref stars (random (length stars))))))
(hole-start (random 30))
(hole-length (random 10)))
(dotimes (i 40)
(setq line (cons (eval (list pick-char)) line)))
(setq line (apply 'concat ";" line))
(insert line)
(setq overlay (make-overlay (+ 1 (point-at-bol)) (point-at-eol)))
(overlay-put overlay 'face `(:foreground ,color :height 1 :background "#242444"))
(newline)))
(defun insert-star-lines ()
(let* ((hole-start (1+ (random 25)))
(hole-length (+ 5 (random 10)))
(hole-chars " ┼─│")
(hole-char (char-to-string (aref hole-chars (random (length hole-chars))))))
(dotimes (i 20)
(insert-stars)
(save-excursion
(previous-line)
(beginning-of-line)
(forward-char hole-start)
(dotimes (i hole-length)
(delete-char 1)
(insert hole-char)))
(when (= 0 (random 3))
(setq hole-start (1+ (random 25)))
(setq hole-length (+ 5 (random 10)))
(setq hole-char (char-to-string (aref hole-chars (random (length hole-chars)))))))))