summary refs log tree commit diff
path: root/doc/tilde30.t
blob: c17d27dfc4910b74c3a5771ea0bfe78836656005 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
---
title: TILDE30
subtitle: nine mens morris fennel game
author: dozens
created: 2024-06-01
updated: 2024-06-14
---
.pl 999i
.ce
{{title}}

.ce
{{subtitle}}
 
.IP 01
what  is up tilde30 fans it's ya boi dozens back with another up date on my
project! today i found a bug that was preventing mills from  being recognized
as mills. my algorithm for detecting mills is kind of (probably needlessly?)
complex. but luckily, i had already  written  a small module for writing unit
tests. so after a small refactor to isolate the individual steps as functions
that i  can  export,  i imported them into a test file and was able to more
carefully examine each step. turns out  the  culprit  was  a small  reducer in
which i was doing an 'and' when i ought to have been doing an 'or'. literally
just  changed  one  word  and  that fixed  it.  but i'm still pleased with the
process by which i arrived at that realization. i'm now confident that the
entirety of the  mill detection algorithm does what i want it to do. yay unit
tests!
.
.
.IP 02
today's goal was to implement capturing. but instead i discovered a bug in
rendering the board, and fixed  that.  i  didn't  bother taking  the  time to
really understand why the bug was happening. but after rewriting (and
simplifying) the render  function,  it's working correctly now. so yippee for
that. up next: capturing!
.
.
.IP 03
went to go do some remote smol computering.  posted up at the library and fixed
a small typo that was preventing the  game  state from  advancing  from phase 1
to phase 2.  and that's about all i could stand doing whilst coding on my
phone.  later, on  my  laptop,  successfully  implemented  capturing.   next
up: prevent a player from capturing a checker that is part of a mill.  i  think
this  will lead to a refactoring of the 'mill?' algorithm to generalize it a
little more.
.
.
.IP 04
i did not work on tidle30 today. not enough spoons.
.
.
.IP 05
today i did the refactor of the 'mill?' algorithm.
i ended up making it much more simple than how i had originally written it.
and it works pretty great!
the goal of this refactor was to be able check for a mill
after a move in order to change the game phase from placing to capture,
and also to check for a mill before a move
in order to check whether a capture is legal.
(a capture cannot break up a mill.)
as predicted,
my test-driven development workflow
made the refactor pretty painless.
i just got tripped up for a while
because i didn't realize i was passing the wrong type of move to the function.
you see, i have two different representations of a move:
one is a number 1 - 24 referring to the index of an array of player moves
(that is, the game state is a single array with values 0 = vacant, 1 = occupied by player 1, 2 = player 2);
and the other is an alphanumeric value (e.g. A1, b4, 7G)
referring to a place on the game board.
i frequently have to convert e.g. B2 into 4.
and what i don't really have right now
is a good type system that can tell me if i passed the wrong type to a function.
oh well!
i guess i'll have to do some manual type checking
in each function if i really want that kind of type safety.
this completes milestone 3: capture a checker.
next up:
implement some kind of a play counter
so the game can transition from placing to sliding.
.nf
http://cgit.tilde.town/~dozens/9mm/commit/?id=7776b2011a2585723078b275c838fd7332488d76
.fi
.
.
.IP 06
added transitioning from Placing to Moving,
and also implemented Moving logic.
this completes milestones 4 and 5.
starting to feel like a real game!
after getting my ass beat yesterday
by unknown function parameter types,
i added some type assertions to my new function.
and sure enough,
later on i passed the wrong value to the function.
but this time the assertion failed
and gave me a useful error message.
wahoooooo!
no time wasted tonight haha.
up next:
fix a bug that prevents captures from happening
during the moving phase?
watching:
maniac (2018) on netflix,
starring emma stone and jonah hill.
.nf
http://cgit.tilde.town/~dozens/9mm/commit/?id=f985dc4e5c9fdec06436c21440c3dc7245369847
.fi
.
.
.IP 07
as i said earlier,
there is currently a bug
that is preventing the board
from updating when a capture happens.
instead of working on the bug,
i instead focused on how sad it makes me
to have to enter 18 - 20 moves every time
just to test the capturing ui in the moving phase of the game.
this sadness inspired me to write an expect(1) script
that will interact with the game ui
and make all the moves for me.
much faster!
then i abstracted and isolated the moves
into a data file
so that for future ui testing,
i can just write down a list of moves
and not write a whole expect script.
and then i wrote a small awk script
that will convert data files into expect files.
so now i have some basic ui scripting,
which is maybe the first step toward actual ui testing?
and i have already used it to confirm the behavior
in both the placing phase
and the moving phase.
so it's not anything unique to phase 2
despite my original suspicions.
thanks, tests!
up next:
fix the dang bug
.nf
http://cgit.tilde.town/~dozens/9mm/commit/?id=91b1662302c14cf84ca8b90c1f3ec20a585f67a5
.fi
.
.
.IP 08
with fresh eyes,
i was able to see the bug that was preventing capturing.
it was a single line in the update function.
and i deleted it!
then i set about trying to allow transitioning
moving to flying.
but i introduced another bug
that i can't find right now..
it prevents capturing in the moving phase.
i'll have to look at it more later.
right now,
i have to finish packing!
i'm going on vacation!
we'll see whether or not i'm able to continue
working on 9mm / tilde30
while away from home.
i'm not bringing my laptop.
so i'll be limited to coding on my phone
with my little folding bluetooth keyboard.
.
.
.IP "WEEK ONE REVIEW"
when i look back on week one,
i feel like i made more progress
than i had expected to.
even while spending time on writing unit tests
and "ui tests."
if i keep up this pace
then i expect i'll be done with the game in another week.
but i'm on vacation next week,
so i'm not confident that i will keep up the pace.
whether or not i get around to it as part of tilde30,
i do want to build a gui frontend for the game.
because i think that would be fun.
.
.
.IP "09-13"
i did not do any computering
during this five day low-tech beach vacation.
.
.
.IP 14
fixed the bug that prevented capturing during the moving phase.
implemented flying!
and also handled an edge case
where you cannot break up a mill
when capturing
unless there are no other non-milled checkers.
in which case
you can break up a mill
when capturing.
up next:
ending the game.
.
.
.IP 15
implemented a game ending!
now if a player has fewer than 3 checkers,
the other player wins the game.
up next:
endgame edge case where if a player has 3 or more checkers,
but no available legal moves,
then they lose.
.
.
.IP "WEEK TWO REVIEW"
light week.
spent almost all of it on vacation
and not working on tilde30 at all.
nonetheless,
i'm mostly finished with the core of the game.
i have one small edge case to iron out
and then the game will be all the way complete.
i think for my first stretch goal,
i want to add some kind of generative story mode
based on player moves and decisions, etc.
so that by the time you're done with the game,
you have a unique little story to take with you.
i'm not sure whether i want to do a tracery grammar
type of thing..
could be fun to try to write that.
well here's to tilde30 being half over!
hope everybody is having fun making progress
on your projects!
.
.
.IP 16
I wrote the "no-moves?" function
to determine whether a player has no legal moves remaining.
And a test for it.
But integrating it created a bug I need to track down.
.
.
.IP 17
Didn't fix the bug,
but rewrote "no-moves?"
using the "->" threading macro
which is neat.
I've never used it before.
It's basically the "compose" or "pipe" function
that I have enjoyed using before in javascript.
up next: fix that bug!
.
.
.IP 18
Finished the game today!
(I think!)
Working on modularizing the core logic
and tidying up some of the libraries.
Up next: Story Mode.
.
.
.IP 19
Just did a bunch of tidying up.
Consolodated some libs.
(All table funs into a 'table' modules, e.g.)
Rewrote a couple of functions.
Sometimes using the threading macros
can replace a 'let' block
with a tighter pointfree composition
that I sometimes like.
My surgery is tomorrow.
After that I am going to be in a lot of pain /
on a lot of drugs,
and will be spending a lot of time on my back.
So I'm either going to get a lot on 9mm,
or nothing at all.
We'll see!
.
.
.IP "20 - 21"
I was having back surgery!
.
.
.IP "WEEK THREE REVIEW"
Finished the game, and then had a major surgery.
Doing some tidying up and housekeeping now.
Organzing tests,
breaking stuff out into modules.
Rewriting and refactoring a couple of functions.
Generally getting ready to start thinking
about Stretch Goal 1: Story Mode.
I have a vague inkling of an idea about
doing some kind of generative story / narration
based on each move of the game.
Assign symbolic meaning to the outer, middle, and inner rings of the board.
Add a little twist based on whether the move is a capture, a slide, a placement.
That kind of thing.
Not sure how I want to do it exactly yet.
I'd like to be able to show the story progress as you play.
But updating the story every move seems like kind of a lot.
Maybe just at every game phase.
So three installments.
One at the end of Placement,
the second at the end of Movement,
and the third at the end of the game?
Anyway.

Up next: big refactor of the validation logic.
I don't want it to just print to console
if I'm going to eventually support multiple frontends.
I need to return an error code or something
for the client to interpret.
I'm still interested in the Result / Either monad option
but I think I'm doing to first try the conventional lua way
and throw an error, and then 'pcall' the function and handle the error politely.
.
.
.IP "WEEK FOUR REVIEW"
Today is the end of tilde30!
I didn't get too much done this week
on account of the surgery.
At least,
I wasn't able to keep up with the daily updates.
I did end up writing a tracery-lite
type templating thing
that you can find
in `src/story`.
I did not succeed in
actually incorporating it into the game.
But it's there.

tilde30 on the whole was a fun exercise
and a success.
I had a lot of fun working on my project,
and I especially had a lot of fun hearing about other people's projects.
Even if they didn't complete them.
I am planning to do it again in September,
and am planning to continue working on 9mm
in the meantime!

.pl \n[nl]u