Interesting programming exercise- no loops

I read about a university course where the students had to write C code without using For, While or Goto for loops. Instead they had to use recursion.
Yes it’s bound to be inefficient compared to the looping structure but that’s not the point. For instance for a loop like this:
for (int i=0;i<10;i++) {
DoSomething(i);
}
It could be done as
void DoSomething(int i) {
if (i==10) return;
// Do whatever here
DoSomething(i+1);
}
DoSomething(0);
The point isn’t to teach you to write inefficient code but to think a bit differently. I’ve used recursion quite extensively in the Slay tutorials code. Here’s an example. It sets a field continent in all adjacent land squares where continent == -1.
void FillIn(int x, int y, int island) {
if (onMap(x, y)) {
if (island == map[x][y].island && map[x][y].continent == -1) {
map[x][y].continent = numContinents;
allContinents[numContinents].count++;
FillIn(x - 1, y, island);
FillIn(x + 1, y, island);
FillIn(x, y - 1, island);
FillIn(x, y + 1, island);
FillIn(x - 1, y - 1, island);
FillIn(x + 1, y - 1, island);
FillIn(x + 1, y + 1, island);
FillIn(x - 1, y + 1, island);
}
}
}

Core war is an old game concept that dates back to 1984. If you imagine a simple CPU with small programs written in assembly language trying to wipe each other out, that’s Core War and you can read about it in a lot more detail o

I had this tutorial pencilled in to do and it’s 
Back in 2014, an Italian developer called Gabriele Cirulli devised a puzzle game called 2048. It has been implemented on many platforms (I have it on my iPhone) and here is
Looking at some of the posts on the 