1 / 53

Scratch programming for elementary schools’ teachers

Scratch programming for elementary schools’ teachers. 賴阿福 台北市立教育大學 資訊科學系 2011/7/18~7/20 lai@go.tmue.edu.tw. Scratch. 演變來源: Logo : Turtle graphics (MIT Papert) programmable bricks : LEGO MindStorms (MIT)

preston
Télécharger la présentation

Scratch programming for elementary schools’ teachers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scratch programming for elementary schools’ teachers 賴阿福 台北市立教育大學 資訊科學系 2011/7/18~7/20 lai@go.tmue.edu.tw

  2. Scratch • 演變來源: • Logo :Turtle graphics (MIT Papert) • programmable bricks:LEGO MindStorms (MIT) • The building-block approach draws on previous research on LogoBlocks (Begel, 1996) and Etoys (Steinmetz, 2001), • 特色: • Building-block programming. Scratch programming will be based on a building-block Metaphor. Learners will drag-and-drop blocks from the library to create “stacks” (procedures) that govern behaviors of the object. • Multiprocessing will be smoothly integrated into Scratch: different stacks of blocks will automatically execute in parallel. • Programmable image processing • rich media • Principal Investigators: • Mitchel Resnick, MIT Media Laboratory • Yasmin Kafai, UCLA • John Maeda, MIT Media Laboratory

  3. Examples of Scratch script • Turtle graphics • Loop control • 猜數值 • 加法練習:亂數出題 • 減法練習 • 打擊魔鬼 • Retrieve element from list • List當題庫 • Rolling ball • Ball game • Maze game • music • OX棋

  4. Download Scratch 1.4 • V 1.4:http://info.scratch.mit.edu/Scratch_1.4_Download • V 2.0 beta

  5. Educational application • Why learn programming? • Computer curriculum • Integration into teaching • Math • Art • Music • literature • Work creation tool in PBL • Game design • Story-telling

  6. 1 3 2 4 5 6 7 操作介面 • 標題列:顯示軟體與檔案名稱。3 • 功能表列:常用的存檔、開新檔案、開啟舊檔與復原等功能。4 • 指令分類區:Scratch指令共分八類均在此區中。5 • 程式積木區:依指令分類區點選的類別而出現對應的程式積木。6 • 角色與舞台控制區:點選快速瀏覽區可顯示欲控制角色(舞台)之程式、造型(背景)與聲音的控制。77 • 舞台區:動畫編輯的區域。 • 舞台背景與角色快速瀏覽區:舞台背景與角色切換的控制。

  7. 第一次接觸: 會塗鴉(scratch)的貓 • Two events: • main(), onload • Click, onlcick • Can we change drawing color? Infinite loop

  8. Basic elements of programming • Structure programming • Sequence • Iteration, repetition • For, while, repeat until • Selection • If else if … , • switch case • Memory control • Variable, • Array, list • Input /output • Console I/O • File I/O • Database • Event • Keyboard • Mouse • Startup • Function, method, subroutine, procedure • Caller • Callee • Object (sprite, stage) • Method • Data (property) In Scratch: no offered

  9. Loop control-1 • Question: 1+2+…+n=? • what’s wrong? • Similar to c • For(i=0;i<n;i++, sum=sum+i) ; • For(i=0;i<n+1;sum=sum+I, i++) ;

  10. Loop control-2 • Repeat { } until (); • what’s wrong?

  11. Loop control-3 • Similar to While () { } • what’s wrong?

  12. Loop control-4 • Question: 1+3+…+n=? Handle error of input what’s wrong?

  13. Loop control-5 • Question: n!=1*2*…*n=? • what’s wrong?

  14. Features • Visualized programming environment • Brick building and assembling • Syntax-error free • multithread • Object-like :method for each object, we can clone them • Structured programming is convenient • Iteration ( Loop): for, while, repeat…. utile • Sequence • Selection • If, if..else • Not provide switch case • Turtle geometry • LOGO • System Function • Random, math • User-defined function: Only for event driven function • Onload • Click event (belong to a object) • Multimedia rich environment • Function communication: shared memory, message passing • Memory management is limit: Variable • Not offered array, but provide list • String processing is limit • Array of object: not support • File I/o is limit • The functions of Input, printf are limit • Game element • Conflict detection

  15. Function communication • shared memory, message passing Object 2 accept broadcast message Object 3 Global variable Object n Object 1 Shared memory

  16. Scratch2Exe • 將Scratch的.sb檔轉為.exe(scratch2exe) • 方法:http://cc1.shsps.kh.edu.tw/xoops/modules/tadnews/index.php?nsn=27 Scratch scratch2exe .sb .exe Web browser Java applet

  17. Turtle graphics Run this program Main program pendown logo-1.sb

  18. variable • Variable? • Where? • What purpose? • Make a variable Size=input(“輸入移動步數”); FD size logo-2.sb

  19. 運算式 logo-3.sb

  20. 猜數值 • Random • 提示輸入數值?大或小 • loop 停止條件 • 猜的次數 guess-number-1.sb

  21. 改變背景 1 4

  22. 加法練習 ADD-drill1.sb

  23. 減法練習 • 答案不可以為負數 sub-DR~1.sb

  24. 減法練習2 • 答錯須重新回答 • 運用一變數correct • 中文變數 sub-DR~2.sb

  25. 打擊魔鬼 • 打擊者 • 按鍵控制 • 廣播”發射子彈” 打擊魔鬼1/fight-monster-1.sb

  26. bullet • 接到”fire”之廣播,發射子彈 • 判斷遇到邊緣或魔鬼 • 子彈之初始設定

  27. 魔鬼須不斷上下移動 • 被打到時:消失、回到原點

  28. Retrieve element from list • List:列表、串列 • 替代array • Why not work? • 循序讀取

  29. List當題庫 • 結構:題目+選項+答案 • Other method: 運用6個 list,分別存放題目、4個選項、答案 (parallel lists) list-process-1-2.sb

  30. 亂數出題:list放亂數不重複之題號 不重複!(1..n) Swap /exchange rseq i 1 3 pick rseq i 2 5 pick list-process-1-3.sb

  31. 亂數由題庫抽題

  32. Insertion sort insertion-sort-1.sb

  33. Rolling ball 角色:ball Direct=1 Direct=0 Direct=2 Direct=3 y 第一象限 第二象限 x 第三象限 第四象限 BALL-B~correct-1.sb

  34. Change ball’s direction 3 Y>168 Direct=0 1 X>228 0 Direct=1 2 X>228 Y<-168 3 Direct=2 1 Y<-168 X<-228 Y>168 0 Direct=3 2 X<-228

  35. Game of 桌球 角色:panel • 角色:panel Score varaible 由ball detect collision BALL-game-1.sb

  36. Maze game-1 Initial position destination

  37. Maze game-1(續) • Game is over if time out What’s wrong?

  38. Maze game-2:第二關 換第二關背景 Maze←2 maze-2.sb

  39. Maze game-2(續) • Direct : • sprite’s data member • Not global variable 先上後下移動 舞台換背景 先右後左移動

  40. Maze game-2(續) • Maze=1 • 第一關 • Else (maze=2) • 第二關

  41. Maze game-2(續) 遇到crab or ant, then die 二關之起始位置一樣

  42. 打地鼠 • 地鼠被打到:record[i]=1 • End==1:6隻地鼠全被打到 kill-mice/kill-mice-1.sb

  43. 打地鼠(ccont.) Die: object之data member, not a global variable monster1 hole1 將monster放在hole上

  44. music • note(音符) 60代表Do(1)、62 Re(2)、64 Mi(3)、65 Fa(4)、67 Sol(5)、69 La(6)、71 Si(7)、72 高音Do(1*)

  45. Sing a song • 每個音節有2拍,第一個音節就是Do Do各半拍(0.5 beats),然後Do Mi又各半拍(0.5 beats)。

  46. OX棋 • Use list “record” to record player’ dice • 0: null • 1: user • 2: CAT • Each dice: has 3 styles • Cat broadcast message “flip i”, dice i will flip its style for CAT. • User can click the dice to flip it. • There are some drawbacks in it. • Please revise them. ox-game-1.sb

  47. Compute who is the winner? • Winner=0 (initial) • Winner=1 (user) • Winner=2 (CAT) 3 2 1 5 6 4 7 8 9 • If (Record[1]=record[2] and record[2]=record[3]) { • If record[1]=1 then winner=1; • Else if record[1]=2 then winner=2; }

  48. If winner is known, then this game is over!

  49. Method of dice • Accept message to flip its style for CAT • Click event: user clicks the dice to flip its style 1st dice

More Related