I added 3 variables:
int shuffle=0;
int bounce=0;
int randheight=0;
loop:
while (sig_caught == 0 && (c = getch()) != 'q') {
// the following is the code I came up with
shuffle++;
if (shuffle == 10)
{
bounce++;
shuffle=0;
}
maxtemp = bounce;
if (bounce > (12 + randheight))
{
randheight=rand() % 2;
bounce = 12 - randheight;
}
// end of my code
if(c == KEY_UP || c == 'k') maxtemp++;
if((c == KEY_DOWN || c == 'j') && maxtemp > 1) maxtemp--;
Let me know what you think?
Thank you!
I added 3 variables:
int shuffle=0;
int bounce=0;
int randheight=0;
loop:
while (sig_caught == 0 && (c = getch()) != 'q') {
// the following is the code I came up with
shuffle++;
if (shuffle == 10)
{
bounce++;
shuffle=0;
}
maxtemp = bounce;
if (bounce > (12 + randheight))
{
randheight=rand() % 2;
bounce = 12 - randheight;
}
// end of my code
Let me know what you think?
Thank you!