Challenge : Look for a pattern and make this code shorter using loops.

According to  computer programming, a loop is a sequence of instructions that is continuously repeated until a certain condition is reached. Loop is a one of the basic structures of programming.

Here it’s a challenging puzzle in which we have to look for a pattern and make the code shorter by using lesser blocks. According to the workspace we need  to use only 5 blocks and should manage to run the program. As we can see the same blocks are repeated several times.

In this programming code use the repeat loop block to reduce the number of blocks.

Following steps were done to complete the puzzle.

Step 1 -  For running the code when run block is compulsory. Now see the pattern which is repeated and remove the repeating blocks which are exceeding the limit. Set color random color, Move forward by 80 pixels and turn right by 45 degree are the blocks which are repeated many times due to which workspace limit got exceeded.

Step 2 - As we know that repetition of sequence is known as loop n here the pattern is repeated several times. Now add  the repeat loop block after set width for repetition.

Already the width is set to 20 , it should not be more or less than 20 otherwise we will not proceed to the next level of puzzle.

Step 3 - Add the repeating pattern blocks i.e Set color , Move forward and turn right block inside the repeat loop block.

While running the program we will observe the different color , Move forward by 80 pixels and turn right by 45 degrees block  the shape will be drawn according to the shaded line. If we change the degrees and pixels number we won’t be  able to solve the puzzle as it will not run through the shaded line.

Step 4 - After adding the Repeat loop block see the number of times the pattern is repeating. Count the number of times he has to repeat the pattern. Here the pattern is repeating 8 times so, we type 8 in repeat loop block.

You can also try another number to see whether we can run program.

Step 5 - As of now we have set the program using limited blocks, now Run the programming to complete the puzzle.

Well it seems that the programming did work with limited blocks.

You can also try many ways to run the programming , sometimes we may have different methods to solve the puzzle.

For kids solving puzzles in this way will make it easier for them to learn.It’s interesting and fun loving to solve.