Difference between revisions of "CSC103: DT's Notes 1"
Line 814: | Line 814: | ||
All we have done is simply put line numbers in front of each group of numbers said by the two people. It doesn't appear that it's helping us much, but it is actually a big steps, because now we can refer to each line by a number, and we get closer to creating an ''algorithm''<ref name="algorithm">Algorithm, in ''Wikipedia'', retrieved Oct. 3, 2012, from http://en.wikipedia.org/wiki/Algorithm</ref>. | All we have done is simply put line numbers in front of each group of numbers said by the two people. It doesn't appear that it's helping us much, but it is actually a big steps, because now we can refer to each line by a number, and we get closer to creating an ''algorithm''<ref name="algorithm">Algorithm, in ''Wikipedia'', retrieved Oct. 3, 2012, from http://en.wikipedia.org/wiki/Algorithm</ref>. | ||
+ | |||
+ | Let's add a new sentence and a number to our list: | ||
+ | |||
+ | 20 Go back to... | ||
+ | |||
+ | Let's see if you can figure out where we are going with this. What does this new series of numbers mean? | ||
+ | |||
+ | 00: 01 02 | ||
+ | 01: 02 | ||
+ | 02: 03 06 | ||
+ | 03: 01 05 | ||
+ | 04: 20 00 | ||
+ | |||
+ | You probably guessed it: it's the same conversation as before, but at the end the '''20 00''' numbers instruct us to go back to Line 0 and we start the conversation again. Just like a movie playing in an endless loop. While this may not seem terribly interesting, it is actually quite powerful. | ||
+ | |||
+ | Let's go one step further and now imagine that instead of two interlocutors, we have a prof and a whole class of students, and we'd like to imagine the prof having a conversation with the whole class. But remember, the rule is to only use numbers. How can we indicate that the conversation should be with one person first, then with the next, then the next, and so on? | ||
+ | |||
+ | One way to make this happen is to introduce more ''coding'' in our game. | ||
+ | |||
+ | # we give a number to each student in the class, starting with 0 (in computer science we always like to start with 0 when we count) for the student who is closest to the left front corner of the room. | ||
+ | # we give the number to the neighbor of Student 0, and keep giving numbers to everybody, in a logical way, until everybody in class has a number. | ||
+ | # we introduce a new number and sentence combination. | ||
+ | |||
+ | 30 Start with Person... | ||
+ | 31 Move to next person | ||
+ | |||
+ | |||
+ | |||
{| style="width:100%; background:#FFC340" | {| style="width:100%; background:#FFC340" |
Revision as of 20:15, 3 October 2012
--© D. Thiebaut 08:10, 30 January 2012 (EST)