about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2022-10-07 23:55:01 +0000
committerelioat <elioat@tilde.institute>2022-10-07 23:55:01 +0000
commit1a6af4c104ea9d168f947ce082d0f6336f8ea036 (patch)
treed2df6311a4f82c66dce22707c1b3600d5e977466
parent4bfb6004249c9469a5411847498373b9621f0d67 (diff)
downloadtour-1a6af4c104ea9d168f947ce082d0f6336f8ea036.tar.gz
pomodoro timer in forth
-rw-r--r--forth/pomo.forth44
1 files changed, 44 insertions, 0 deletions
diff --git a/forth/pomo.forth b/forth/pomo.forth
new file mode 100644
index 0000000..f568bb9
--- /dev/null
+++ b/forth/pomo.forth
@@ -0,0 +1,44 @@
+( POMO POMO POMO )
+
+VARIABLE POMO-TIME
+1500000 POMO-TIME !
+
+VARIABLE REST-TIME
+600000 REST-TIME !
+
+( TODO: Consider using VALUE instead of VARIABLE )
+
+: 1SEC  1000  MS ;
+: 30SEC 30000 MS ;
+: 60SEC 60000 MS ;
+
+: PRETTY-TIME
+	1000 / 
+	60 / 
+; 
+
+( DECREMENTS POMO-TIME if it is greater than 0 )
+: CHECK-POMO-TIME? 
+	0> IF
+		POMO-TIME @ 1000 - POMO-TIME ! ." 🍅" SPACE POMO-TIME @ PRETTY-TIME . ." minutes" CR
+		." ....." SPACE POMO-TIME ? CR
+	ELSE 
+		REST-TIME @ 1000 - REST-TIME ! ." 😴" SPACE REST-TIME @ PRETTY-TIME . ." minutes" CR
+		." ....." SPACE REST-TIME ? CR
+	THEN
+;
+
+( POMO-LOOP exits when POMO-TIME reaches 0 )
+( FIXME: reset POMO-TIME and REST-TIME once they've reached 0 )
+: POMO-LOOP
+	BEGIN
+		PAGE 
+			POMO-TIME @ CHECK-POMO-TIME? 1SEC 
+		PAGE
+		POMO-TIME @ REST-TIME @ + 0=
+	UNTIL
+;
+
+POMO-LOOP
+
+BYE
2010-03-12 21:07:16 +0100 committer hut <hut@lavabit.com> 2010-03-12 21:50:54 +0100 standardized formatting of headings in doc/' href='/akspecs/ranger/commit/doc/colorschemes.txt?id=a8f9cf2c8bcd2432b1b82a68422102a6924864d6'>a8f9cf2c ^
efdc7b16 ^


















a8f9cf2c ^

efdc7b16 ^














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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101