# Basic Computational Thinking Exercise

Exercise: block problem

3 blocks ABC rest on a desk. What are the steps to stack B on C on A?

After completing the exercise, continue:

Computational thinking allows for us to arrive at well defined steps based on the tool that we are using.

If a robotic Arm Were used the steps would be:

1. Lift B
2. Place B on C
3. Lift C
4. Place C on A

If we were directing a human, we might arrive at:

1. Place B on C
2. Place C on A

You may arrive at an entirely different solution:

1. Place C on A
2. Place B on C

Computational thinking allows for us to find General solutions to problems also. For example, if our problem was

“ N blocks rest on a table. Create a stack using all blocks. “

Using a robotic arm , our solution would be:

1. Start with an empty space for a stack area on the table
2. Lift an unstacked block from the table and place it on the designated stack area.
3. If any other unstacked blocks rest on the table that are not in the stack,
1. Lift an unstacked block
2. Place the block on the stack
4. Repeat Step 3 until there are no more blocks.

Note that:

• This solution can solve multiple problems i.e n could be 0,1,6 etc.
• The task always gets done regardless of the order of how the blocks are stacked.

# Using Computational Thinking to solve a Math problem

In this class, we use computational thinking to solve a mathematical problem.

## Class Activity – Finding the sum of a range of numbers

Task: Without the aid of your classmates, find the sum of all whole numbers from 1 to 200 inclusive.

(15 minutes)

Discovery: at least 3 different methods were found. One interesting solution was the addition of al the ones (1+11+21..+91 = 460) then all twos (2+12+22+…+92 = 470) etc.

### Teacher Demonstration and Discussion

Practical: Observe students suggestions, pattern recognition, past algorithms, decomposition into sub problems

Demonstrate:

1+2+3+4+…………+197+198+199+200

Observe the sum of pairs from out going in always sum to 200.

Determine the number of pairs.

Note that the steps to solve this problem are:

• Find the sum of the first and last numbers (1+200)
• Find the number of pairs (200/2)
• Multiply the results of 1 and 2.

### Further Exersises and Discussion – Finding the Sum of a Range Of numbers

Homework:

• Using a similar approach as shown above, write the set of steps to find the sum of numbers from 1 to 10
• Write the steps to find the sum of any range of numbers from which form a complete number of pairs. (e.g 5 to 10)
• Write the steps to find the sum of any range of numbers from which form an incomplete number of pairs. (e.g 5 to 11)

# Introduction to Computational Thinking

## Class Practical

In this class we shall observe some logic games.

### Preparation

• Students are to divide their copybook page into two columns (page is folded vertically to quickly set up the scenario).
• The first column is given the heading “Steps”.
• The second column is unlabeled.

### Wolf Sheep And Cabbage

• 1 student is chosen at random to perform the task of solving the problem in the game. We call this student the “actor”.
• All other students are instructed that they are not allowed to talk or assist during the exercise ( No blurting out “no” Prep students for  self control)
• The game is explained to the actor.
• Discuss the first actions with the actor. Silent students must write their first action, the main student takes his own action.
• As consequences emerge, students and the actor write down the rules.
• Every reset, write down the steps.

### Discussion

-Are there any students with a different solution?

-Are there any rules for the boat?

-Are there different ways to start the problem?

### In class Exercise

Write the steps to solve the problem.

### Homework

Visit http://www.softschools.com/games/logic_games/ and play some of the logic games.

Write down some of the rules for the games that you have played. Use the following format:

 Game name Goal(s) Rules Wolf, Sheep and Cabbage. Main goal: Get all items safely across the river Secondary Goals: Do not lose any items to ‘eating’ ·         Only one item is allowed in the boat ·         The sheep and wolf should never be left alone ·         The cabbage and the sheep should never be left alone.

In your notebook, complete at least 3 rows of the table. i.e the rules and goals for at least 3 logic games.