easters

easters.dev solutions (C)
git clone git://bsandro.tech/easters
Log | Files | Refs | LICENSE

commit 8a8d6cb14c77f026a879431ef99595dc3d201b96
parent 3718a0d09ad652f77ec83de71f80abd48c94dd20
Author: bsandro <email@bsandro.tech>
Date:   Sun, 11 Jan 2026 04:27:50 +0200

sunday parsing

Diffstat:
Asunday.c | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/sunday.c b/sunday.c @@ -0,0 +1,45 @@ +#include <stdio.h> + +// 5x5 test +// 12x12 real + +int main(void) { + char map[14][14] = {0}; + int xmines[12] = {0}; + int ymines[12] = {0}; + int w = 0; + int h = 0; + for (char c=getchar();c!=EOF;c=getchar()) { + if (c>='0'&&c<='9') { + if (h==0) { + xmines[w++]=c-'0'; + } else { + ymines[h-1]=c-'0'; + w=0; + } + } else if (c=='.'||c=='O'||c=='G') { + map[h-1][w++]=c; + } else if (c=='\n'&&w>0) { + h++; + } + } + h-=1; + printf("w:%d,h:%d\n", w, h); + for (int y=0;y<h;++y) { + for (int x=0;x<w;++x) { + printf("%c", map[y][x]); + } + printf("\n"); + } + puts("ymines:"); + for (int y=0;y<h;++y) { + printf("%d,", ymines[y]); + } + printf("\n"); + puts("xmines:"); + for (int x=0;x<w;++x) { + printf("%d,", xmines[x]); + } + printf("\n"); + return 0; +}