>>103531524
If anyone is interested, here's how I'd translate those the first 5 functions into more typical C. 46 lines versus just 13. And that's with the autistic column count restriction. Denser code is better IMO. Less jumping around when you're trying to read.
int times_16(int n); // not shown in my post, gives n << 4
char *nth_row(int irow) {
return times_16(irow) + well;
}
void well_drain(void) {
memset(well, size_well, 0);
}
void well_scrub(int irow, int ucount) {
int ndel = times_16(ucount);
int nmove = times_16(23 - (irow + ucount)); // *
memmove(nth_row(irow), nth_row(irow + ucount), nmove);
memset(nth_row(24) - ndel, ndel, 0);
}
// * note my previous post mistakenly has
// `24 swap -` instead of the correct 23.
// C needs help returning more than one value.
struct i2 { int a, b; };
struct p2 { char *a, *b; };
struct p2 bounds(char *, int); // library function
int row_is_full(int irow) {
int result = -1;
struct p2 bnds = bounds(nth_row(irow), 10);
for (char *i = bnds.b; i < bnds.a; i++) {
if (!*i) {
result++;
break;
}
}
return result;
}
struct i2 well_scan(void) {
struct i2 result = {23, 0};
for (int i = 0; i < 24; i++) {
if (row_is_full(i)) {
i2.a = (is.a < i ? i2.a : i);
i2.b++;
}
}
return result;
}