I am writing a function that draws the letter @ on the console screen, and until it 'h' which is already have created. Actually a "bomb" ceremony I wrote the function with a loop for a while, so long as it is portraying that picture, it is not like 'h', until it continues to attract the character. If it does equal 'H', then I have put in an I statement to break the program. However, even if with the statement, the program is run while dragging on 'H'.
zero bm_in_heat (int home_radius) {int x = 0, y = 0; While (mvinch (y, x)! = 'H') {x = get_next_bomb_x (); Y = get_next_bomb_y (); Mwadch (Y, X, '@'); Fresh (); Sleep (1); If (mvinch (y, x) == 'h') {break; P>
Your code pulls a @
and then Checks for one H
(twice) Obviously, this is not searching for a H
because it only attracts a @
.
Let's see if you have a new status:
zero bm_int_heat {int home_radius} {int x = 0, y = 0; While (Mwitch (Y, X)! = 'H') {// 5) Check for H = x get_next_bomb_x (); // 1) Go to the next X y = get_next_bomb_y (); // 2) Go to the next Y Mwatch (y, x, '@'); // 3) Refresh here (@); Sleep (1); If (mvinch (y, x) == 'h') {// 4) check for the breaks of h; }}}
You need to rearrange the order of your statements so that once you move to a new place, then check it before you write it.
No comments:
Post a Comment