Hello guys,
I'm trying to remember some MSX Basic coding, and I tried to port this recursive C code that solves the Hanoi Tower game. Problem is, MSX Basic lacks resources to do recursion, like function parameters. I searched the net, and I only found MSX Basic code that allows you to play the game, but I just need to solve the game, not play it.
Anyone can help me to port this code to MSX Basic?
void movetower (int n, char orig, char dest, char aux){
if (n==1) {
printf("\nMove disc 1 from tower %c to tower %c", orig, dest);
return;
}
movetower(n-1,orig,aux,dest);
printf("\nMove disc %d from tower %c to tower %c", n, orig, dest);
movetower(n-1,aux,dest,orig);
};
int main() {
int discs;
printf("\t\t\t\tHANOI TOWER\n\n");
printf("Enter number of discs: ");
scanf("%d",&discs);
movetower(discs,'A','C','B');
return 0;
}