/*

  Made by Marcel Vlastuin, marcel@codecup.nl.
  Generator for the game Squares (CodeCup NIO 2025).
  For more information: nio.codecup.nl.
  This program is part of the Caia project for the CodeCup NIO 2025.
  The code is "as it is".

*/

#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "secure_rng.h"

#define N (4)

int main (void) {
	int lijstkleur[N];
	FILE *fout;
	shake256_context sc;

	SRAND(&sc);

	for (int i = 0; i < N; ++i) {
		lijstkleur[i] = i + 1;
	}

	fout = fopen("tiles.txt", "wt");

	int colour_p1 = RAND(&sc, N) + 1;
	int colour_p2 = RAND(&sc, N - 1) + 1;
	if (colour_p2 >= colour_p1) {
		++colour_p2;
	}

	assert(colour_p1 != colour_p2);
	fprintf(fout, "%d\n%d\n", colour_p1, colour_p2);

	for (int i = 0; i < 50; ++i) {
		RANDOM_SHUFFLE(&sc, lijstkleur, N);
		for (int j = 0; j < N; ++j) {
			fprintf(fout, "%d", lijstkleur[j]);
		}
		fprintf(fout, "\n");
	}
	return 0;
}
