# Bugs in circle game tutorial

Peeps,

Iâ€™m a bit of a noob so please bear with me. I think I may have found some bugs in the example code for the simple circuit game tutorial found here: Circuitmess Resources

Firstly, the math shown in the block code image for direction_check does not match the math of the final C code at the bottom of the page. The block code example uses all > operators and the final C code example uses all < operators. Unfortunately, I do not believe either of them is correct. The math that I am using is as follows:

if (up == 1) {
if (y > 0 + radius) {
y += -1;
}
}
if (down == 1) {
if (y < 127 - radius) {
y += 1;
}
}
if (right == 1) {
if (x < 127 - radius) {
x += 1;
}
}
if (left == 1) {
if (x > 0 + radius) {
x += -1;

Secondly, I had to remove â€śString colorâ€ť from the draw_circle subroutine (function). The compiler did not like it. I had to load it into IDE to figure this out as I wasnâ€™t able to find any helpful debug info in circuitblocks.

Lastly, the if statements for button A being pressed and button B being released do not make sense. In the case of button A being pressed the block says if color < 2 set color to 1, else color = 0. This will always return with color = 1 because it is indeed less than 2. Similarly, when button B is released if radius < 30 set radius to 5, else radius = 10. Again, this will always return with radius = 5. I believe the intent here is this:

When button A is pressed if color is < 2 change color by 1, else color = 0.
When button B is released if radius < 30 change radius by 5, else radius = 0.
(note: I chose to else radius = 0 rather than 10 in the tutorial because the variable radius is not set initially and will default to zero when the program is first run. This is my attempt to be consistent with the behavior of the program. Thereâ€™s nothing wrong with else radius = 10)

Hopefully this all makes sense.

Regards,
Aaron

1 Like

I just realized that in Arduino run first there is a statement set left to 10. I believe this should be set radius to 10. That would better explain else radius = 10 in the button B if statement.

1 Like

Hi @aaronh,

thank you for reaching out.

We are fixed the bugs you mentioned, and weâ€™ll be updating our coding guide today.

Sincerely,
Monika from CircuitMess