Ask coding questions

← Back to all posts
Why is this breaking?
ArulMoorthy (0)

I made a 2D ASCII thing and I wanted to experiment with terrain generation. I tried to make a basic system to randomly assign materials, and now the system is broken. Please help bruh. AND YES, I KNOW ABOUT PERLIN NOISE.

Edit: If you look in the code you can see that I have a player icon that isn't showing up either.

Comments
hotnewtop
MocaCDeveloper (563)

Line 133, you automatically clear the terminal.
So, in this instance, do this:

system("clear");
check_player_input(player_input);

That way the terminal refreshes the old feed thereafter getting the users input.

ArulMoorthy (0)

@MocaCDeveloper nah this isn't a good method, I don't wanna clear the board before processing the player's input. Plus, there is no advantage to refreshing the old feed before processing the new input.

MocaCDeveloper (563)

@ArulMoorthy

You're going to have to try and figure out how to print it after the terminal is cleared then..perhaps returning the value you want to print via the function call, then printing it to the console after the terminal is cleared?