Web Title:112 學年度 台南市進學國小資訊組112 學年度 台南市進學國小資訊組

Scratch 函式與遞迴 (自訂新積木)

Scratch 函式與遞迴 (自訂新積木)

使用繪圖方式介紹「函式」與「遞迴」,可以視覺化的方式觀察特徵,感受規律性。此處則以「落地反彈」的現象介紹函式與遞迴,嘗試理解函式積木的特色與優點,並且呈現遞迴的「重複效果」(Tail Recursion尾遞迴)。函式為 Scratch 的進階功能,常見於多數的程式語言。函式的使用讓我們以更直覺的方式描述問題,解決問題,我們解決問題不再是逐一列舉,而是以規則和規律性來處理問題,而遞迴的使用則提供另一種更為簡潔的規則來處理問題。

  1. 函式積木
  2. 為何使用函式積木
  3. 函式積木的優點
  4. 函式積木與參數
  5. 參數
  6. 新增函式積木
  7. 程式片段
  8. 問題應用
  9. 問題描述
  10. 方法1:循序
  11. 方法2:重複
  12. 方法3:函式與遞迴
  13. 方法比較

電子書,Scratch 函式與遞迴:

http://odata.tn.edu.tw/ebooktagapi/Intro/Index2?id=b83ccee183d642b7852ec1cad60ae82c

Scratch 範例,三種方式彈跳 (循序、重複、遞迴):

https://scratch.mit.edu/projects/225806763/

參考文件:

相關連結:http://odata.tn.edu.tw/ebooktagapi/Intro/Index2?id=b83ccee183d642b7852ec1cad60ae82c
  • slider image 1
  • slider image 2
  • slider image 3
  • slider image 4
  • slider image 5
  • slider image 6
  • slider image 7
  • slider image 8
  • slider image 9
  • slider image 10
  • slider image 11
  • slider image 12
  • slider image 13
  • slider image 14

準備全國紫錐花盃反毒機器人競賽

全部 錯誤訊息 (14) 已棄用 (0) 資料庫語法 (21) 區塊 (2) 額外資訊 (2) 計時(6)
錯誤訊息
警告: Undefined array key "menu_var_kind" 在檔案中的第 /modules/tadtools/preloads/core.php 列 213
未知: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated 在檔案中的第 /modules/tadtools/class/Tools.php 列 650
未知: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated 在檔案中的第 /modules/tadtools/class/Tools.php 列 650
警告: Undefined array key "openid_login" 在檔案中的第 /modules/tadtools/preloads/core.php 列 238
警告: Undefined array key "openid_login" 在檔案中的第 /modules/tadtools/preloads/core.php 列 238
警告: Undefined array key "tad_web_adm" 在檔案中的第 /modules/tad_web/function.php 列 1926
警告: Undefined array key "LoginMemID" 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^9af185c8a6f5101b426c270ec9cc3a00cf0cdcc0_0.file.tad_web_header.tpl.php 列 103
警告: Attempt to read property "value" on null 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^9af185c8a6f5101b426c270ec9cc3a00cf0cdcc0_0.file.tad_web_header.tpl.php 列 103
警告: Undefined array key "LoginParentID" 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^9af185c8a6f5101b426c270ec9cc3a00cf0cdcc0_0.file.tad_web_header.tpl.php 列 103
警告: Attempt to read property "value" on null 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^9af185c8a6f5101b426c270ec9cc3a00cf0cdcc0_0.file.tad_web_header.tpl.php 列 103
警告: Undefined array key "mem_parents" 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^46b0b6b30a99de56b2aa1ab0ecbd2a45a9360010_0.file.tad_web_login.tpl.php 列 111
警告: Attempt to read property "value" on null 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^46b0b6b30a99de56b2aa1ab0ecbd2a45a9360010_0.file.tad_web_login.tpl.php 列 111
警告: Undefined array key "mem_parents" 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^46b0b6b30a99de56b2aa1ab0ecbd2a45a9360010_0.file.tad_web_login.tpl.php 列 250
警告: Attempt to read property "value" on null 在檔案中的第 /www/wwwroot/class/xoops_data/caches/smarty_compile/ee35f82e_tad_web_for_tad_web_theme_default^46b0b6b30a99de56b2aa1ab0ecbd2a45a9360010_0.file.tad_web_login.tpl.php 列 250
已棄用
資料庫語法
0.000078 - SET SQL_BIG_SELECTS = 1
0.000573 - SELECT * FROM config WHERE (`conf_modid` = '0' AND `conf_catid` = '1') ORDER BY conf_order ASC
0.000192 - SELECT sess_data, sess_ip FROM session WHERE sess_id = '8i3p50le10k1qpa9cai5rkachn'
0.000365 - SELECT COUNT(*) FROM group_permission WHERE (`gperm_modid` = '1' AND (`gperm_groupid` = '3') AND `gperm_name` = 'module_read' AND `gperm_itemid` = '6')
0.000313 - SELECT * FROM config WHERE (`conf_modid` = '6') ORDER BY conf_order ASC
0.000245 - SELECT * FROM config WHERE (`conf_modid` = '4') ORDER BY conf_order ASC
0.000437 - SELECT * FROM config WHERE (`conf_modid` = '0' AND `conf_catid` = '5') ORDER BY conf_order ASC
0.000236 - SELECT * FROM config WHERE (`conf_modid` = '0' AND `conf_catid` = '3') ORDER BY conf_order ASC
0.000589 - SELECT DISTINCT gperm_itemid FROM group_permission WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (3)
0.000831 - SELECT b.* FROM newblocks b, block_module_link m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id IN (0,6) AND b.bid IN (1,2,3,4,5,6,7,8,9,10,11,18,15,16,20,19,58,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,112,106,108,107,109,110,111,113,114,115,116,117) ORDER BY b.weight, m.block_id
0.000368 - SELECT f.*, s.tpl_source FROM tplfile f LEFT JOIN tplsource s ON s.tpl_id=f.tpl_id WHERE (`tpl_tplset` = 'default' AND `tpl_file` = 'tadtools_qrcode_block.tpl') ORDER BY tpl_refid
0.000312 - SELECT f.*, s.tpl_source FROM tplfile f LEFT JOIN tplsource s ON s.tpl_id=f.tpl_id WHERE (`tpl_tplset` = 'default' AND `tpl_file` = 'system_block_dummy.tpl') ORDER BY tpl_refid
0.000794 - SELECT `conf_value` FROM `config` WHERE `conf_name` = 'allow_register'
0.000304 - SELECT `mid`, `name`, `dirname` FROM `modules` WHERE `isactive` = 1 AND `hasmain` = 1 AND `weight` != 0 ORDER BY `weight`
0.000145 - SELECT `conf_value` FROM `config` WHERE `conf_title` = '_MD_AM_DEBUGMODE'
0.000162 - SELECT COUNT(*) FROM `priv_msgs` WHERE `to_userid` = 0 AND `read_msg`=0 GROUP BY `to_userid`
0.000576 - SELECT * FROM users WHERE uid = '46798'
0.000593 - SELECT * FROM `tad_web_files_center` where `col_name`='NewsID' and `col_sn`='13275' order by sort
0.000406 - SELECT * FROM config WHERE (`conf_modid` = '8') ORDER BY conf_order ASC
0.000192 - SELECT `tt_theme`,`tt_use_bootstrap`,`tt_bootstrap_color`,`tt_theme_kind` FROM `tadtools_setup` WHERE `tt_theme` = 'for_tad_web_theme'
0.000380 - SELECT f.*, s.tpl_source FROM tplfile f LEFT JOIN tplsource s ON s.tpl_id=f.tpl_id WHERE (`tpl_tplset` = 'default' AND `tpl_file` = 'tad_web_tpl.tpl') ORDER BY tpl_refid
總計: 21
區塊
本頁面行動條碼: 沒有快取
自訂區塊(HTML): 沒有快取
總計: 2
額外資訊
包含檔案: 197 檔案
使用記憶體: 1744896 bytes
計時
XOOPS 使用 0.595 秒來載入。
XOOPS Boot 使用 0.019 秒來載入。
Module init 使用 0.019 秒來載入。
XOOPS output init 使用 0.014 秒來載入。
Module display 使用 0.532 秒來載入。
Page rendering 使用 0.012 秒來載入。