Difference between revisions of "CSC111 Games around Functions"

From dftwiki3
Jump to: navigation, search
(Game 2)
Line 23: Line 23:
 
** Call Student2
 
** Call Student2
 
** Call Student3
 
** Call Student3
 +
 +
<br />
 +
<br />
 +
<br />
 +
<br />
  
 
=Game 2=
 
=Game 2=
Line 41: Line 46:
 
** repeat 2 times:
 
** repeat 2 times:
 
*** Call Student3
 
*** Call Student3
 
+
<br />
  
 
=Game 3=
 
=Game 3=

Revision as of 10:37, 3 March 2014

--D. Thiebaut 09:47, 20 October 2011 (EDT)




Each game below can be played in class just to get the idea of what goes on. Think of the game as a play. Students are actors and have lines to say. When the director points to an actor, the actor says her line. Once a game is played in class and fully understood, translate it into python, using functions.


Game 1

  • Student 1
    • Say "Banana!"
  • Student 2
    • Say "Orange!"
  • Student 3
    • Say "Peanut Butter!"
  • Main
    • Call Student1
    • Call Student2
    • Call Student3





Game 2

  • Student 1
    • Say "Banana!"
  • Student 2
    • Say "Orange!"
  • Student 3
    • Say "Peanut Butter!"
  • Main
    • repeat 3 times:
      • Call Student1
    • Call Student2
    • repeat 2 times:
      • Call Student3


Game 3

  • Student 1
    • Say "Caramba!"
  • Student 2
    • Say "No, No, No!"
  • Student 3
    • Call Student 1
    • Say "Si!"
  • Main
    • Call Student 2
    • Call Student 1
    • Call Student 3

Game 4

  • Student 1 ( sentence )
    • Get sentence
    • Say the sentence
  • Student 2 ( sentence )
    • Get sentence
    • Say "My T-Shirt says: "
    • Say the sentence
  • Student 3 ( sentence )
    • Get sentence
    • Say "And now listen to this: "
    • Call student 1 and pass her sentence
  • Main
    • Call Student 1 and pass "I am tired"
    • Call Student 2 and pass "I live for Chocolate"
    • Call Student 3 and pass "We have no labs on November 10!"

Game 5

  • Student 1 ( sentence )
    • Get sentence
    • Say "My T-shirt says"
    • Say sentence
  • Student 2 (sentence1, sentence 2 )
    • get sentence 1
    • get sentence 2
    • Say sentence 1
    • Call Student 1 and pass sentence 2
    • Say "Thank you!"
  • Student 3 (sentence 3 )
    • get sentence 3
    • call student 2 and pass sentence3, and "Hello"
  • main
    • Call Student 3 and pass "Caramba!"