ecco7777

mathe lernen mit CC

Mar 2nd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. c=peripheral.wrap("top")
  2. difficulty=20
  3. Mode={"+","-","*","/"}
  4. while true do
  5. i1=math.random(1,difficulty)
  6. i2=math.random(1,difficulty)
  7. mode=math.random(1,4)
  8. c.say(tostring(i1)..Mode[mode]..tostring(i2))
  9. if mode==1 then res=i1+i2 end
  10. if mode==2 then res=i1-i2 end
  11. if mode==3 then res=i1*i2 end
  12. if mode==4 then res=math.floor(i1/i2*100)/100
  13. e,player,message = os.pullEvent("chat")
  14. while message~=tostring(res) do
  15. print(player..message)
  16. e,player,message = os.pullEvent("chat")
  17. end
  18. c.say(player.." du hast recht!")
  19. sleep(1)
  20. end
Add Comment
Please, Sign In to add comment