Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void mirror(int x) {
unsigned u;
memcpy(&u,&x,sizeof(int));
printf("%u\n",u);
if (u) mirror(u/2);
}
void marbles(int *n) {
*n--;
printf("\t\tx_%d\n",*n);
mirror(--(*n));
}
int GetTheBallRolling(int z) {
printf("%d\n",z);
if (z <= 1) return z;
z++;
if (z%2) return GetTheBallRolling(3*z+1);
return GetTheBallRolling(z/2);
}
int main(void) {
int z = rand()%12;
int x = 0;
printf("Not so random, huh: %d\n", z);
x = GetTheBallRolling(z);
if (z) marbles(&z);
printf("Come on people, more code!\n");
return 0;
}