Files
Cody Boone Ferguson 8ccdfde9b1 Fixes in 2005/aidan and add alt code
The alt code is in the README.md. It felt like it should be alt code
based on what the author stated.

Fixed the perl test suite. The script hardcoded the name of the binary
but this was not 'aidan' as the author submitted it as 'sudoku-sf'. This
broke the script (though I did not test it before, only after).

Added to the list of files noted by the author those which were in the
tarball and changed the names of any incorrectly named files to be
correct.

The author stated that in the US sudoku is known not as sudoku but
rather Number Place. This however is not true so I removed it as it most
likely isn't confusing but still not right (I didn't believe the name,
hadn't seen it and did a search and found nothing of the sort).

Since the author is from the UK and since they used British English
spelling I changed 'period' to 'full stop' as it should be (the author
put a '.' in parentheses so it's not confusing to anyone who doesn't
know the term anyway).

Format fix README.md.

Typo fixes.

Update .gitignore due to alt code.
2023-04-27 08:49:45 -07:00

10 lines
571 B
C

#include <stdio.h> /* sudoku-bfi.c */
#define S(t) for(n=0;n<9;v[n++]=0);for(n=0;n<81;n++)if(i[n]){z=1<<i[n];if(v[t]\
&z)for(;;){if(p<0)goto d;if(i[p]++<9)goto f;i[p]=0;p=s[p];}v[t]|=z;}
int i[82],s[81],v[9],n,p,z;int main(void){for(n=0;n<81;){p=getchar()^48;if(p==
30)p=0;if(p<10)i[n++]=p;}i[81]=0;p=-1;f:S(n%9)S(n/9)S(n%9/3+n/27*3)if(p>80)goto
d;for(n=p;i[++p];);s[p]=n;i[p]=1;goto f;d:z=p<81;printf("\n%s!\n\n",z?"Fail":
"Success");for(n=0;n<81;){p=i[n];printf("%c %s",(p?p|48:'.'),(++n%3?"":n%9?"| "
:n%27?"\n":n%81?"\n------+-------+------\n":"\n\n"));}return z;}