ãåç»æ稿ããã¤ã¯ã©ã§ããã°ã©ãã³ã°ãã¦éã³ã¾ããã ï¼3ãæ稿ãã¾ãã
ãã¤ã¯ã©ã§ããã°ã©ãã³ã°ãã¦éã³ã¾ããã ï¼3ãï½ã³ã¼ããæ¸ããç·¨ï½
çãããã°ã©ã ãæ¸ãã¦ãããã°ã©ãã³ã°ãä½é¨ãã¾ãããã ã¾ãã¯ãã¿ã¼ãã«ãèªç±ã«åããããã°ã©ã ã«ã¤ãã¦ã§ãã
ãã³ãã³åç»ã¯ãã¡ã
Youtubeã¯ãã¡ã
åç»ä¸ã§ä½¿ã£ãPPTãã¡ã¤ã«ï¼PDFå¤ææ¸ã¿ï¼ã¯ãã¡ã
ãåç»æ稿ããã¤ã¯ã©ã§ããã°ã©ãã³ã°ãã¦éã³ã¾ããã #1 #2ãæ稿ãã¾ãã
ã¯ããã«
ã¨ããããã¯ããã°ã®ãã¿ãå«ãã¦åç»æ®ããå ¬éãã¾ããã ãã®ãæä¸ã«ãã²ã¼ã å®æ³ã¹ã¿ã¤ã«ã§ã¯ãªãã¬ããã¯ã¼ãã¤ã³ãè³æä½µç¨ã¹ã¿ã¤ã«ã
ComputerCraftå°å ¥ç·¨
ããã°ã©ãã³ã°ã¨ããéã³ã®é å説æãComputerCraftã®ç´¹ä»ãTwitchã®åãåãããã¤ã¯ã©JEã¨CCã®ã¤ã³ã¹ãã¼ã«ã¾ã§
åç»
åç»å ã§ä½¿ã£ãPPTï¼PDFå¤ææ¸ã¿ï¼
ã¿ã¼ãã«ã«å½ä»¤ç·¨
ã¿ã¼ãã«ã®æºåãããã³ãã³ãå ¥åãã¿ã¼ãã«ãèªç±ã«åããã¾ã§
åç»
åç»å ã§ä½¿ã£ãPPTï¼PDFå¤ææ¸ã¿ï¼
æç¶ãã«ååãã¤ãã¦ããã¨èªä½é¢æ°ãä½ããããã®ã§ã
ã¯ããã«
ååããã ãã¶éãããã¾ããããåºãããã¯æ·è¨ããã°ã©ã ã¯å½¹ç«ã£ã¦ãã¾ããï¼
ã³ãã³ãå ¥åæã«ã³ãã³ãã©ã¤ã³å¼æ°ãä¸ãããã¨ã§é·ããæå®ã§ããã®ä¾¿å©ã§ãããã
ä»åã¯ãã®ããã°ã©ã ã®å 容ãåæ¤è¨ãã¦ã¿ã¾ãããã
åºãããã¯æ·è¨ããã°ã©ã
ååã®ããã°ã©ã ã®åæ²ã
ãªããªãé·ãããã°ã©ã ã§ããããã£ã¦ãããã¨èªä½ã¯æå¤ã¨ã·ã³ãã«ãªã®ã¯ããã¾ã§ã®ããã°è¨äºãèªãã§ããã¨ãããã¾ãããã
ã§ããããªãã¨ãæãã¾ãããï¼
ããªãã ããåããããªãã¨ãä½åº¦ãç¹°ãè¿ãã¦æ¸ãã¦ãªãï¼ã
以åãç¹°ãè¿ãforæãç´¹ä»ããã¨ãï¼éå»è¨äºï¼ã«ããåãæç¶ããä½åº¦ãæ¸ãã®ã¯é¢åãªã®ã§ã代ããã«foræ使ã£ã¦åæ°æå®ãã¦ç¹°ãè¿ããæ¹æ³ã«ã¤ãã¦èª¬æãã¾ãããforæã使ããã¨ã§åé·ã§ç¡é§ãªè¨è¿°ãæ¸ã£ã¦ãå ¨ä½ããã£ãããã¾ããã
ä»åã¯ãã¾ãå¥ã®ããã£ããæ¸ãæ¹æ³ã説æãã¾ãã
åé·ãªé¨åã§ä½ããã£ã¦ããã®ãä¸è¨ã§èª¬æããã
ã¾ãç¹å¾´çãªã®ã¯ã以ä¸ã®ãããªæç¶ããã³ã¼ãä¸ã«äºååºç¾ãã¦ãããã¨ã§ãã
-- ã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãã for slot=1,16 do local kosuu = turtle.getItemCount( slot ) if (kosuu > 0) then turtle.select( slot ) break end end
è¡çªå·ã§è¨ãã¨ã19ã26è¡ç®ã¨42ã49è¡ç®ã®äºç®æã§ããåãå 容ã2åæ¸ãã¦ããã®ã§ãªãã ãç¡é§ãªæ°ããã¾ããã
ã§ã¯ãã®æç¶ãã¯ä½ããã£ã¦ããã®ã§ããããï¼
ä¸è¨ã§è¦ç´ãããªãã°ããã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãããæç¶ãã§ãããã
ãã®æç¶ãã«æ³¨ç®ãã¦ã¿ã¾ãããã
æç¶ãã«ååãã¤ãã¦ãã
ãã®ãã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãããæç¶ãã§ãããã³ã¼ãå ¨ä½ã§ã¯ãã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãããæç¶ããäºç®æããããã§ããªãã¨ããã®ãã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãããæç¶ããçç¥ãã¦æ¸ãæ¹æ³ãã»ã»ã»ã
ã»ã»ã»é·ããï¼ä¸è¨ãããªããï¼ããã®æç¶ãã«ã¯ãã£ã¨çãååãã¤ããªããã¾ãããã
ãã¨ãã°ã¡ãã£ã¨ã ããã£ãã¤ãã¦è±èªã§ååãã¤ãã¾ããããã
ãselectItemSlotã(âãselect (an) item slotãâãã¢ã¤ãã ã¹ããããé¸æãã)
ã¨ãã©ãã§ãããã
æ°ããé¢æ°ãå®ç¾©ãã
ããã°ã©ã è¨èªã§ã¯ãä½åº¦ã使ã決ã¾ãåã£ãæç¶ãããé¢æ°ï¼ãµãã«ã¼ãã³ã¨å¼ã¶ãã¨ãããï¼ã¨ãã¦å®ç¾©ã§ãã¾ããä¸åº¦é¢æ°ã¨ãã¦å®ç¾©ãã¦ãã¾ãã°ããã®é¢æ°ã¯ä½¿ãæ¾é¡ã¨ãªãã¾ãã
èªåã§æ°ããé¢æ°ãå®ç¾©ããã«ã¯ã以ä¸ã®è¡¨è¨æ¹æ³ã使ãã¾ãã
function é¢æ°å() ãã£ã¦æ¬²ããæç¶ããæ¸ã end
ãã®è¡¨è¨æ¹æ³ã使ã£ã¦ã以ä¸ã®ããã«ãselectItemSlotãé¢æ°ãå®ç¾©ãã¾ãããã
function selectItemSlot() -- ã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãã for slot=1,16 do local kosuu = turtle.getItemCount( slot ) if (kosuu > 0) then turtle.select( slot ) break end end end
ä»åã¯ä¸è¨ã®ããã«ããfunction é¢æ°å()ãããendãã®éã«ããselectItemSlotãã®å ·ä½çãªæç¶ããã³ãããã¾ããã
ãã ãã®ã¾ã¾ã ã¨ãã¤ã³ãã³ãï¼è¡é ã®ç©ºç½ã¹ãã¼ã¹ï¼ãä¸æãã§ä¸æ ¼å¥½ãªã®ã§ã以ä¸ã®ããã«æ´ãã¾ããã
function selectItemSlot() -- ã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãã for slot=1,16 do local kosuu = turtle.getItemCount( slot ) if (kosuu > 0) then turtle.select( slot ) break end end end
以ä¸ã®ããã«ã·ã³ãã«ã«
ãã®ããã«æ°ããé¢æ°ãselectItemSlotããå®ç¾©ã§ããããã§ãã®ã§ããã®æ°é¢æ°ã使ã£ã¦åé·ãªæç¶ããç½®ãæããã¨ãããªæãã«ãªãã¾ãã
-- åºã«ãããã¯ãæ·ãè©°ããªããæå®ããæ©æ°ã ãåã«é²ã for i=1,hosuu do -- ã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æãã for slot=1,16 do local kosuu = turtle.getItemCount( slot ) if (kosuu > 0) then turtle.select( slot ) break end end turtle.placeDown() turtle.forward() end
ä¸è¨ã®åé·ãªè¡¨è¨ãã
以ä¸ã®ãããªãé¢æ°ã使ã£ãã·ã³ãã«ãªè¡¨è¨ã¸
-- åºã«ãããã¯ãæ·ãè©°ããªããæå®ããæ©æ°ã ãåã«é²ã for i=1,hosuu do selectItemSlot() turtle.placeDown() turtle.forward() end
ããã§ã®ãã¤ã³ãã¯ãä½ã£ãé¢æ°ãselectItemCountããå®è¡ããããã«ã¯ãæ«å°¾ã«ã()ããã¤ãã¦ãselectItemCount()
ã®ããã«æ¸ããã¨ã§ããã()ããå¿ããã¨å®è¡ã§ããªãã®ã§è¦æ³¨æã
èªä½é¢æ°ãå©ç¨ããå®æçããã°ã©ã
æçµçã«ä»¥ä¸ã®ãããªããã°ã©ã ã«ãªãã¾ãã
ãã®ããã°ã©ã ã«ã¯3ã¤ã®éè¦ãªãã¤ã³ããããã¾ãã
ã¾ãã³ã¡ã³ãã®------- Config ------
ã®ãããªåºåãç·ã«æ³¨ç®ãã¾ãããã
注ç®ãããã¨ã§ãããã°ã©ã å ¨ä½ã®æ§é ã以ä¸ã®ããã«ãªã£ã¦ãããã¨ããããã¾ãã
- Config é¨ï¼ãããã°ã©ã å ¨ä½ã®è¨å®ãã©ã¡ã¼ã¿ã¼ãè¨è¿°ããé¨åãæåãå¤ããããã«æ¸ãæãã¦ãè¯ãã
- Functions é¨ï¼ãå ¨ä½ããã£ããã¨è¡¨è¨ããããã«ãæ°ããé¢æ°ãå®ç¾©ããé¨åã
- Main é¨ï¼ãå®éã«ã³ã³ãã¥ã¼ã¿ãå®è¡ããæç¶ãã表è¨ããé¨åã
ãã®ããã«3é¨æ§æã«ãªã£ã¦ãããã¨ã«æ°ã¥ããã¨ãæåã®ãã¤ã³ãã§ãã
2ã¤ç®ã®ãã¤ã³ãã¨ãã¦ã åãã¦è¦ãããã°ã©ã ãèªã¿è§£ãæã«ã¯ããã®Mainé¨åããå§ãããã¨ãéè¦ã§ãã
Mainé¨åãèªãã§ãããã¡ã«ãè¬ã®ï¼ç¥ããªãï¼é¢æ°ãåºã¦ããããããã¯ããã°ã©ã ä½æè ãä½ã£ãæ°ããé¢æ°ã§ããå¯è½æ§ãããã¾ããFunctioné¨ã«æ»ã£ã¦ãã®é¢æ°ãæ¢ããä½ãããé¢æ°ãªã®ã解æãã¾ãããã
ãªããèªä½é¢æ°ã®ååããselectItemSlotãã®ããã«ãããããããã®ã«ãã¦ããã°ããã¢ã¤ãã ã®ã¹ããããé¸ãã§ãããé¢æ°ãã ã¨ããç¨åº¦æ¨æ¸¬ãã¤ãã¾ãã®ã§ãFunctioné¨ãèªã¾ãªãã¦ãå ¨ä½ã®åããæ´ããããã«ãªãã¾ãã
é¢æ°ã®ååã¯ããã®æåã説æãããããããããã®ã«ãããã¨ãå¿ããã¾ãããã
ã¤ã¾ãããé¢æ°ã®ååã¤ãã¯éè¦ï¼ã
3ã¤ç®ã®ãã¤ã³ãã¨ãã¦ãé¢æ°ã®å®ç¾©ã¯å®éã«ãã®é¢æ°ãå®è¡ãããããåã§è¡ãã¾ããããã¤ã¾ããé¢æ°ãå®ç¾©ããFunctioné¨ã¯ãå®éã«ãããå®è¡ããMainé¨ãããåã«ç½®ããã¨ããã¤ã³ãã§ãã
èªè ã¸ã®å®¿é¡
ãã®ããã°ã©ã ã¯ãä»ã«ãåé·ãªè¨è¿°ãããããããã¾ãã
ãã¨ãã°ã以ä¸ã®ãããªé¢æ°ãFunctioné¨ã§å®ç¾©ãã¦ããã®é¢æ°ã使ã£ã¦ã·ã³ãã«ã«æ¸ãæãã¦ã¿ã¾ãããã
- spreadBlockAndForward() : çä¸ã«ãããã¯ãè¨ç½®ãã¦åã«1æ©é²ãé¢æ°
- goRight() : å³ã«ç§»åããï¼å³ãåãã¦åã«1æ©é²ãï¼é¢æ°
ãã¾ã
ã¹ãããã®ãã®æ²ãããããã ï¼ã¢ãã£åºåã§ã¯ãªãAmazonååã¸ã®ãã ã®ãªã³ã¯ã§ãï¼
- ã¢ã¼ãã£ã¹ã: ã¹ããã,èéæ£å®
- åºç社/ã¡ã¼ã«ã¼: ã¦ããã¼ãµã«J
- çºå£²æ¥: 2002/10/16
- ã¡ãã£ã¢: CD
- è³¼å ¥: 1人 ã¯ãªãã¯: 31å
- ãã®ååãå«ãããã° (113件) ãè¦ã
ããã®ã¤ã³ãã³ããªã¯16ã¹ãããã¾ã§ããã
- ã¯ããã«
- ã¿ã¼ãã«ã®ã¤ã³ãã³ããªã«ã¤ãã¦ã®åºç¤ç¥è
- ãµã³ãã«ããã°ã©ã 1
- ãµã³ãã«ããã°ã©ã 2
- åºãããã¯æ·è¨ããã°ã©ã ã®æ¹åç
ã¯ããã«
ååã¾ã§ã«åºãããã¯æ·è¨ããã°ã©ã ãæ¹é ãã¦ãã¾ãããã å®ã¯ããã¦ãè´å½çãªå¼±ç¹ã«è§¦ãã¦ããªãã£ããã§ãããã
ã»ã»ã»ãããã¿ã¼ãã«ã®1ã¹ãããã®å®¹éã§ãã64åã¾ã§ãããããã¯ãæ·è¨ã§ããªããã§ãã
ã¤ã¾ãã
> yuka4 64
ãã大ããªæ°ã¯ç¡çãªãã§ããã ããããã®å®è¡ã§ã¯ãçé64æ©åã ãæ·è¨ãã¦ã復路ã¯ä½ããã帰ã£ã¦ãã¡ããã¾ãã
ã¿ã¼ãã«ã¯ã¤ã³ãã³ããªã16ã¹ããããæã£ã¦ããã®ã§ãããããããããã¾ãæ´»ç¨ããããã®ã§ãã
ã¿ã¼ãã«ã®ã¤ã³ãã³ããªã«ã¤ãã¦ã®åºç¤ç¥è
ã¾ãã¯ã¿ã¼ãã«ã®ã¤ã³ãã³ããªã«æ³¨ç®ãã¾ãããã
ã¿ã¼ãã«ã®ã¤ã³ãã³ããªã«ã¯16åã®ã¹ããããããããããã«çªå·ãã¤ãã¦ãã¾ããæåã¿ã¼ãã«ã¯ä¸çªå·¦ä¸ã®ã¹ãããçªå·1ã«æ³¨ç®ãã¦ãã¾ããã¹ããã1ãå°ãã ã太ãæ ã§å²ã¾ãã¦ããã®ããã®è¨¼ã«ãªãã¾ãã
ãã®ãããªã¿ã¼ãã«ã注ç®ãã¦ããã¹ãããããé¸æã¹ããããã¨å¼ã³ã¾ããã¿ã¼ãã«ããããã¯ãæ¡æããããããã¯ãè¨ç½®ããã¨ãã¯ååã¨ãã¦ãã®é¸æã¹ãããã使ãã¾ãã1
ã¿ã¼ãã«ãèªåã®ã¤ã³ãã³ããªãæä½ããé¢æ°ã¯ããããç¨æããã¦ããã®ã§ãããä»åã¯ãã®ä¸ã§ããã使ãé¢æ°ãæç²ãã¦ç´¹ä»ãã¾ãããã
ãµã³ãã«ããã°ã©ã 1
以ä¸ãä»åã®ãµã³ãã«ããã°ã©ã ãcountSlots.luaãã«ãªãã¾ãã
ããã¯ãã¿ã¼ãã«ãã¹ããã1ãã16ã¾ã§é ã«é¸æã¹ããããå¤ãã¦ããããã®ã¹ãããã«ããã¢ã¤ãã ã®åæ°ãé ã«è¡¨ç¤ºããããã°ã©ã ã§ãã
ãããªåç»ä½ã£ã¦ã¿ããä»åã®ããã°ãã¿ã§ãã#ComputerCraft #ç¾åã®ãã¤ã¯ã©ã¨ååã®ã¿ã¼ãã« pic.twitter.com/jbrtynUWyz
— hevo2 and ð¢ (@hevohevo) October 11, 2019
ããã§ã¯ãã®ãµã³ãã«ããã°ã©ã ã解説ãã¾ãããã
ã¾ãã¯ããã°ã©ã ä¸ã®2ã¤ã®æ°ããé¢æ°ãç´¹ä»ãã¾ãã
é¢æ°å | æ©è½ |
---|---|
turtle.select(slotNum) | é¸æã¹ãããããæå®ããã¹ãããçªå·slotNumã«å¤æ´ããã |
turtle.getItemCount(slotNum) | æå®ããã¹ãããçªå·slotNumã«ããã¢ã¤ãã ã®åæ°ãè¿ãããªããã¹ãããçªå·ãçç¥ãããé¸æã¹ãããã®ã¢ã¤ãã åæ°ãè¿ãã |
ããã°ã©ã ã®åºæ¬çãªæ§é ã¯ã2è¡ç®ã®for slot=1,16 do
ãã6è¡ç®ã®end
ã§æãã é¨åããã«ã¦ã³ã¿ã¼å¤æ°slotã®å¤ã1ãã16ã¾ã§é ã«å¢ãããªãããåè¨16åç¹°ãè¿ãfå½¢ã«ãªãã¾ãã
ã¤ã¾ã以ä¸ã®ããã«ãå¤æ°slotã1ãã16ã¾ã§å¤åããªããã16åç¹°ãè¿ãããã§ããã
- å¤æ°slotã1ï¼ é¸æã¹ãããã1ã«ãã¦ï¼3è¡ç®ï¼ããã®é¸æã¹ãããã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼4è¡ç®ï¼ããã®åæ°ãç»é¢è¡¨ç¤ºï¼5è¡ç®ï¼
- å¤æ°slotã2ï¼ é¸æã¹ãããã2ã«ãã¦ï¼3è¡ç®ï¼ããã®é¸æã¹ãããã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼4è¡ç®ï¼ããã®åæ°ãç»é¢è¡¨ç¤ºï¼5è¡ç®ï¼
- å¤æ°slotã3ï¼ é¸æã¹ãããã3ã«ãã¦ï¼3è¡ç®ï¼ããã®é¸æã¹ãããã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼4è¡ç®ï¼ããã®åæ°ãç»é¢è¡¨ç¤ºï¼5è¡ç®ï¼
- ã»
- ã»
- ã»
- å¤æ°slotã16ï¼ é¸æã¹ãããã16ã«ãã¦ï¼3è¡ç®ï¼ããã®é¸æã¹ãããã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼4è¡ç®ï¼ããã®åæ°ãç»é¢è¡¨ç¤ºï¼5è¡ç®ï¼
ããããã§ããã2ã¤ã®ã¤ã³ãã³ããªæä½ç³»é¢æ°ã®ä½¿ãæ¹ãç解ã§ãã¾ããããããã§ã¯ãå®éã«ãã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æããããã°ã©ã ããä½ãã¾ããããããã¾ã§å¦ãã§ããforæã¨ifæãçµã¿åããã¦ä½¿ãã¾ãã
ãµã³ãã«ããã°ã©ã 2
以ä¸ããã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æããããã°ã©ã ã§ãããselectItem.luaãã§ãã
ä»åã®ããã°ãã¿ã2ã¤ç®ã§ãã#ComputerCraft #ç¾åã®ãã¤ã¯ã©ã¨ååã®ã¿ã¼ãã« pic.twitter.com/cch3S0ZUNw
— hevo2 and ð¢ (@hevohevo) 2019å¹´10æ11æ¥
ãããããè¨è¿°ãäºã¤ããã¾ãã®ã§é ã«è§£èª¬ãã¾ãããã
æ¯è¼æ¼ç®åã¨ã¯
ã¾ã注ç®ãã¦æ¬²ããã®ã¯ã5è¡ç®ã«ããifæã®ãæ¡ä»¶å¼ãã§ãã
ååã®è¨äºã§ã¯ãif ãæ¡ä»¶å¼ã then ããã£ã¦æ¬²ãããã¨ã end
ã¨ããifæã®åºæ¬æ§é ãç´¹ä»ãããæ¡ä»¶å¼ãã«ãçï¼trueï¼ãã¾ãã¯ãå½ï¼falseï¼ããå
¥ãã®ã ã¨ãã解説ããã¾ããã
ä»åã¯æ¡ä»¶å¼ã¨ãã¦(kosuu > 0)
ãè¨è¿°ãã¦ãã¾ãã
ã>ãã¨ããä¸çå·ã¯ãæ°å¦ã®ä¸çã§ã¯ã5 > 3ãã®ããã«ä½¿ã£ã¦ãã5ã¯3ããã大ãããã¨ããäºå®ã表ç¾ããããã§ãããããã°ã©ã ã®ä¸çã§ã¯éãã¾ãã
ç¾å¨ä½¿ã£ã¦ããLuaè¨èªã§ã¯ããA > Bãã¨è¨è¿°ãããã¨ã§ãAã¯Bããã大ãããã©ããããã§ãã¯ããã¾ãããããã®è¨è¿°ï¼A > Bï¼ãæ£ãããªãã°çï¼trueï¼ãè¿ãããã®è¨è¿°ãééã£ã¦ããã°å½ï¼falseï¼ãè¿ãã¾ãã
ãã®ããã«æ°å¦ã®ä¸çã¨ããã°ã©ã ã®ä¸çã§ã>ãã®æåãéãã®ã§æ³¨æãã¾ããããLuaè¨èªã§ã¯ã>ãã®ãããªè¨å·ããæ¯è¼æ¼ç®åãï¼å·¦å´ã¨å³å´ãæ¯è¼ãã¦æ¼ç®ããè¨å·ãã®æå³ï¼ã¨å¼ã³ã¾ãã
ãã®ä¸çå·ä»¥å¤ã«ãæ¯è¼æ¼ç®åã¯ããã¾ããä»ã®æ¯è¼æ¼ç®åãç¥ãããæ¹ã¯ã³ã³ãã¯ãªãã¯
æ¯è¼æ¼ç®å | æ©è½ | 使ç¨ä¾ï¼ã¨è¿ãå¤ï¼ |
---|---|---|
> | å·¦ãå³ãã大ãããªãçï¼å°ãããªãå½ï¼ãè¿ã | 3 > 1 ï¼âtrue ï¼ |
< | å³ãå·¦ãã大ãããªãçï¼å°ãããªãå½ï¼ãè¿ã | 3 < 1 ï¼âfalse ï¼ |
>= | å·¦ãå³ä»¥ä¸ãªãçï¼ä»¥ä¸ãªãå½ï¼ãè¿ã | 3 >= 1 ï¼âtrue ï¼ |
<= | å³ã左以ä¸ãªãçï¼ä»¥ä¸ãªãå½ï¼ãè¿ã | 3 <= 1 ï¼âfalse ï¼ |
== | å·¦ã¨å³ã®å¤ãåããªãã°çï¼éããªãå½ï¼ãè¿ã | 4 == 2 ï¼âfalse ï¼ |
~= | å·¦ã¨å³ã®å¤ãéããªãã°çï¼åããªãå½ï¼ãè¿ã | 4 ~= 2 ï¼âfalse ï¼ |
ããééããã®ãæ¯è¼æ¼ç®åã==ãã§ããã=ãã ã¨å¤æ°ã«ä»£å ¥ããè¨å·ï¼ä»£å ¥æ¼ç®åï¼ã«ãªãã®ã§ã注æãã ããã
æ¯è¼æ¼ç®åã使ã£ãkosuu > 0
ã¨ããå¼ã¯ãå¤æ°kosuuã0ãã大ãããã°çï¼trueï¼ãè¿ãã0ããå°ãããã°å½ï¼falseï¼ãè¿ãã¾ãã
ã¤ã¾ãä»åã¯ããkosuuãã®å¤ã0ãã大ãããã°ï¼ã¤ã¾ããã¢ã¤ãã åæ°ã1å以ä¸ï¼ãªãã°ãthen ã end
ã®ä¸ãå¦çãããã¨ã«ãªãã¾ãã
breakæã¨ã¯
ããä¸ã¤ã®æ°ããè¨è¿°ã¨ãã¦7è¡ç®ã®break
ãããã¾ãã
ãã®è¨è¿°ãã³ã³ãã¥ã¼ã¿ãå¦çããã¨foræãå¦çéä¸ã§ãã£ã¦ããããªããã®forã®å¦çãããã¦forã®å¤ã«æãåºãï¼ãã¬ã¼ã¯ããï¼ã¨ããæåã«ãªãã¾ãã
ãã£ã¦ãã®ããã°ã©ã ã®æåã詳細ã«è¿½ãã¨
- å¤æ°slotã1ï¼ ã¹ããã1ã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼3è¡ç®ï¼ããã®åæ°ã0ãã大ããããã§ãã¯ï¼5è¡ç®ï¼
- å¤æ°slotã2ï¼ ã¹ããã2ã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼3è¡ç®ï¼ããã®åæ°ã0ãã大ããããã§ãã¯ï¼5è¡ç®ï¼
- å¤æ°slotã3ï¼ ã¹ããã3ã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼3è¡ç®ï¼ããã®åæ°ã0ãã大ããããã§ãã¯ï¼5è¡ç®ï¼
- ã»
- ã»
- ã»
- å¤æ°slotã16ï¼ ã¹ããã16ã®ã¢ã¤ãã åæ°ãå¤æ°kosuuã«ä»£å ¥ï¼3è¡ç®ï¼ããã®åæ°ã0ãã大ããããã§ãã¯ï¼5è¡ç®ï¼
ã¨ããåä½ãããã®ã§ãããããããã®ã¹ãããã®åæ°ãã§ãã¯æï¼5è¡ç®ï¼ã«0ãã大ãããã¨ãããã£ãããã¿ã¼ãã«ã®é¸æã¹ãããããã®ã¹ãããã«å¤ããå¾ããããªãforã®å¦çãæãã¦å¤ã«é£ã³åºãã¾ãã ãã¨ãslotã1ã§ãããã¨10ã§ãããã¨ãifã®å¦çã«ãã£ã¦å¼·å¶çforã®å¦çãä¸æãã¦forã®å¤ã«é£ã³åºãã¨ããããã¤ã³ãã§ã
é¸æã¹ãããããã®ã¹ãããã«å¤ãã¦ããforã®å¤ã«ãã¬ã¼ã¯ããã®ã§ããã®ããã°ã©ã ã«ãã£ã¦ããã¢ã¤ãã ãå ¥ã£ã¦ããã¹ããããé¸æã§ããããããªã®ã§ãã
åºãããã¯æ·è¨ããã°ã©ã ã®æ¹åç
ããã§ã¯ããã¾ã§å¦ãã ãã¨ãçããã¦ãä»åã®èª²é¡ã§ãããyuka4ãããã°ã©ã ãæ¹åãã以ä¸ã®ãããªãyuka5ãããã°ã©ã ãä½ãã¾ããã
å ã®ãyuka4ãããã°ã©ã ã¨ã®å¤æ´ç¹ã¯2ã«æã§ãã
turtle.placeDown()
ã¨ãããããã¯ãçä¸ã«è¨ç½®ããé¢æ°ãããã¾ããããã®é¢æ°ã®å®è¡ç´åã«ãããã¾ã§å¦ãã§ãããã¢ã¤ãã ãæã£ã¦ããã¹ããããé¸æãããå¦çãåãè¾¼ãã§ãã¾ãã
ãã®turtle.placeDown()
ã2ã«æããã®ã§ãåãè¾¼ãã ã®ã2ã«æã§ããã
ããããã§ã¤ã³ãã³ããªã®å ¨ã¦ã®ã¹ãããã使ã£ã¦ãããã¯ãè¨ç½®ã§ããããã«ãªãã¾ããã16ã¹ãããå ¨ã¦ã«64åã®ãããã¯ãå ¥ãã¦ããã°ãåè¨1024åã®ãããã¯ãè¨ç½®ã§ãã¾ããï¼
-
ãããã¯ãæ¡æããæã«ãã®ã¹ããããæºã¿ã³ã ã£ããä»ã®ã¢ã¤ãã ã§åã¾ã£ã¦ããæã«ã¯ããã®é£ã®ã¹ãããã«å ¥ãããã¨ãã¾ããéã«ã¢ã¤ãã ãè¨ç½®ãããã¨ããæã«ããã®ã¹ãããã空ã£ã½ã ã£ããè¨ç½®ã§ããªãã¢ã¤ãã ãªãã°ãè¨ç½®ã«å¤±æãã¾ãã↩
ããå¤æ°ã«ä½ãå ¥ã£ã¦ãããªãã°ã»ã»ã»ãï¼ç¡ãå ¥ã£ã¦ããã®ï¼
- ã¯ããã«
- ä½ãå ¥ã£ã¦ãªããå ¥ã£ã¦ã
- ã¨ã©ã¼ãåºãªãããã«æ¹é ãã
- ifæã®ç°¡åãªä½¿ãæ¹
- ãµã³ãã«ããã°ã©ã ã®è©³ç´°è§£èª¬
- çå½å¤
- ãµã³ãã«ããã°ã©ã ã®è§£èª¬
- ããã°ã©ã ã®æçµå½¢
ã¯ããã«
ååè¨äºãããã°ããæéããã¡ã¾ãããããããéããã§ããããã
ååç´¹ä»ãããyuka3ãããã°ã©ã æ´»ç¨ãã¦ã¾ãï¼
ã·ã³ãã«ã§ä¾¿å©ã§ãããã10æ©åã®åºãããã¯ãæ·ãè©°ãããï¼å¾å¾©ã§2åï¼ãªããããã
> yuka3 10
以ä¸ã®ããã«16æ©åã§ãåé¡ãªãããã ããã®åã®ãããã¯32åï¼= 16 × 2ï¼ãã¿ã¼ãã«ã«æ¸¡ãã®å¿ããªãã§ãã ãããã
> yuka3 16
ã§ããä½åº¦ã使ã£ã¦ãããã¡ã«ãããªãã¨ããããã¾ããã§ããï¼
> yuka3
ã¤ã¾ããå¼æ°ãªãã§ãã®ããã°ã©ã ãå®è¡ãããããã½ã¼ã¹ã³ã¼ãã®13è¡ç®ï¼foræã®çµç«¯å¤ã¯æ°åã§ãªãã¨ããã¾ãããã¨ã¨ã©ã¼ã¡ãã»ã¼ã¸ã表示ãããããã§ããã
ã¡ãã£ã¨13è¡ç®ã確èªãã¾ãããã
for i=1,hosuu do
ã¤ã¾ããå¤æ°hosuuã®å¤ãæ°å¤ã§ã¯ãªãã¨ãããã¯å½ããåã§ãããã6è¡ç®ã§local hosuu = ...
ã®ããã«ã³ãã³ãã©ã¤ã³å¼æ°ãå¤æ°hosuuã«ä»£å
¥ãã¦ãã¾ãããããããå¼æ°ãå
¥åãã¦ãªãã®ã§ããã®å¤ã代å
¥ããå¤æ°hosuuã®å¤ãæ°å¤ãªãããããã¾ããã
ä½ãå ¥ã£ã¦ãªããå ¥ã£ã¦ã
ã§ã¯ä½ãå¤æ°hosuuã«å ¥ã£ã¦ããã®ã§ããããã
çµè«ããè¨ãã¨ä½ãå ¥ã£ã¦ãã¾ããã
ãããæ£ç¢ºã«è¨ãã¨ãä½ããªããã¨ããæ å ±ããã®å¤æ°ã«å ¥ã£ã¦ãã¾ãã
ãããLuaè¨èªã§ã¯ãnilãï¼ãã«ï¼ã¨å¼ã³ã¾ããã¤ã¾ãLuaè¨èªã§ã¯ããä½ããªãï¼ç¡ï¼ããnilã¨ãã¦è¡¨ç¾ããããã§ãããè¦ãã¦ããã¾ãããã1
ãç¡ã(nil)ã¯å½ç¶ãªããæ°å¤ã§ã¯ããã¾ããããã®ããã³ã¼ãã®13è¡ç®ã§ããforæã®çµç«¯å¤ã¯æ°åã§ãªãã¨ããã¾ãããã¨ã¨ã©ã¼ãåºã¦ãã¾ã£ãããã§ããã
表示ãããã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ããã°ã©ã ã®ãã¹ãçºè¦ããã®ã«å½¹ç«ã¡ã¾ããç¹ã«ã¨ã©ã¼ãçºçããè¡çªå·ã®æ å ±ã¯éè¦ã§ãããã®å ´æãä¸å¿ã«ããªããã®ãããªã¨ã©ã¼ãèµ·ããã®ããã¹ãæ¨æ¸¬ãããã¨ãã§ããããã§ãã2
ã¨ã©ã¼ãåºãªãããã«æ¹é ãã
ããã§ã¯ãã®ãããªã¨ã©ã¼ãã§ãªãããã«ããã°ã©ã ãæ¹é ãã¾ãããã
æ¹é ã®ããæ¹ã¯ããããã®ã§ãããããã§ã¯ããå¤æ°ã®åæå¤ã決ãã¦ããã¦ãå¼æ°ãå ¥åãããã¨ãã ããã®å¤ã«å¤æ´ãããæ¹åããªã¹ã¹ã¡ãã¾ãã
ã¤ã¾ãã次ã®ãããªã¤ã¡ã¼ã¸ã
- ããããããå¤æ°hosuuã®å¤ã6ã«æ±ºãã¦ããï¼æ°å¤ã¯ä½ã§ã好ãã«ã©ããï¼ã
- ããå¼æ°ã«ä½ãå ¥åãããããããå¤æ°hosuuã®å¤ã«ä»£å ¥ããï¼ã¤ã¾ããä½ãå ¥åãããªãã£ããä½ãããªãï¼ã
ã¨ããæµãã§ãã
ifæã®ç°¡åãªä½¿ãæ¹
ãããâ¯â¯â¯ãªãã°ãâ³â³â³ãããã
ããã°ã©ã ã§ã¯ãã®ãããªæ§æããã使ãã¾ãã3 ãã®ãããªæ§æã表è¨ããã«ã¯ããæ¡ä»¶åå² if æããå©ç¨ãã¾ãããã®ifæèªä½ã¯å°ã è¤éãªã®ã§ãããã¾ãã¯ã·ã³ãã«ãªããã°ã©ã ã§ifæã®åºæ¬çãªä½¿ãæ¹ãå¦ã³ã¾ãããã
以ä¸ã®ããã°ã©ã ããif0.luaãã¨ããããã°ã©ã åã§ä¿åãã¦ãæ§ã
ãªå¼æ°ãå
¥åãã¦å®è¡ãã¦ã¿ã¾ãããããªãã--
ã§å§ã¾ãè¡ã¯ã³ã¡ã³ãã§ãããè¡ã®éä¸ãã--
ãå
¥ã£ã¦ããã¨ãã¯ãã®--
以éã¯ã³ã¡ã³ãã§ãã
以ä¸ãå®è¡ä¾ã
> if0 10 10
> if0 20 20
> if0 6
ãã®ããã«ã10ãã¨ãã20ãã¨ãå¼æ°ãä¸ãã¦å®è¡ããã¨ããã®å¼æ°ãæçµçã«å¤æ°hosuuã«ä»£å ¥ãã¦ãã®å¤ã表示ãã¾ããã¾ããå¼æ°ãä¸ããªãã¨å¤æ°hosuuã®åæå¤ã§ãã6ããã®ã¾ã¾è¡¨ç¤ºããã¨ããããã°ã©ã ã§ãã
ãµã³ãã«ããã°ã©ã ã®è©³ç´°è§£èª¬
ã¾ã3ã4è¡ç®ã®å¤æ°å®ç¾©é¨åã¯ãããã¾ã§è¨äºãèªã¿é²ãã¦ãã人ãªãã°ä½ãåé¡ãªãç解ã§ããã¨æãã¾ãã
ï¼æ³¨æãããã®ã¯ã3è¡ç®ã®è¡¨è¨ã«ãã£ã¦ãä¸çªç®ã®å¼æ°ããå¤æ°arg1ã«ä»£å ¥ããããã¨ã§ããå¼æ°ãè¤æ°å ¥åãã¦ããä¸çªç®ã®ãã®ã ãåãåºãã¾ãï¼
次ã«ifæã§ãããããã¯æ¬¡ã®ãããªæ§é ããã¦ãã¾ãã
if ãæ¡ä»¶å¼ã then ããã£ã¦æ¬²ãããã¨ï¼è¤æ°ãå¯ï¼ã end
if
ãthen
ãend
ã®3ã¤ã®ãã¼ã¯ã¼ããå¿
é ã§ãã®ã§ä½ç½®ãå«ãã¦ãã£ããã¨è¦ãã¾ãããã
ãã¦ããã®ããã£ã¦æ¬²ãããã¨ãã«ã¤ãã¦ã¯ã好ããªãã¨æ¸ãã°ããã®ã§åé¡ãªãã¨ãã¦ãå°ã£ãã®ã¯ãæ¡ä»¶å¼ãã«ãªãã¾ããããã¯ä½ã§ããããï¼
çå½å¤
Luaè¨èªã«ããããæ¡ä»¶å¼ãã¯ãçµæã¨ãã¦æçµçã«ãçãã¾ãã¯ãå½ãã¨ãªãå¼ãåãæ±ãã¾ãã
ã»ã»ã»ãããé£ããã§ãããã¤ã¾ããã®ãæ¡ä»¶å¼ãã®é¨åã«ã¯çï¼true
ï¼ã¾ãã¯å½ï¼false
ï¼ã®ã©ã¡ããã®å¤ããå
¥ããªãã®ã§ãããçã¨ã¯æ£ãããã¨ãããã¨ããå½ã¨ã¯ééã£ã¦ãããã¨ãããã¨ãæå³ãã¾ãã
ããã¦ãã®çå½å¤ã«ãã£ã¦ãifæã¯æåãå¤ããã®ã§ããï¼
ã¡ãã£ã¨ä¾ã示ãã¾ãããã
if true then print("shinndayo") end
ãã®ããã°ã©ã ã§ã¯ãifæã®ãæ¡ä»¶å¼ãé¨åã«ãç(true
)ããã¯ãè¾¼ã¾ãã¦ãããã ãããã®ifæã¯ç¶ããthen ã endãã®ä¸ãå¦çãããã¨ã«ãªããã ããç»é¢ã«"shinndayo"ã表示ããã
if false then print("shinndayo") end
éã«ãã®ããã°ã©ã ã§ã¯ãifæã®ãæ¡ä»¶å¼ãé¨åã«ãå½(false
)ããã¯ãè¾¼ã¾ãã¦ãããã ãããã®ifæã¯ç¶ããthen ã endãã®ä¸ãèªã¿é£ã°ãã¦ä½ãããªããç»é¢è¡¨ç¤ºããªãã
ã¤ã¾ããif ãæ¡ä»¶å¼ã then ããã£ã¦æ¬²ãããã¨ã end
ã¨ããifæã¯ããæ¡ä»¶å¼ãé¨åã«ãçããå
¥ãã¨ããã£ã¦æ¬²ãããã¨ããå®è¡ãããå½ããå
¥ãã¨èªã¿é£ã°ãã¦ãã¾ããããªã®ã§ãã
ãã¦ããã§ããçããå½ãã¨ããã話ãããããã§ãããLuaè¨èªã§ã¯ããå°ããã®çå½å¤ãæè»ã«åãæ±ã£ã¦ãã¦ãtrue
ã»false
以å¤ã«ãçå½ã®åé¡ãåºãèªãã¦ãã¾ããããã次ã®è¡¨ã§èª¬æãã¾ãããã
å½ | ç |
---|---|
false , nil |
ãâãã®2ã¤ä»¥å¤å ¨é¨ |
åºã¾ããnil
ãããã¯ãç¡ããã¨ãã示ãç¹æ®ãªå¤ã§ãããã
Luaè¨èªã§ã¯ããã®nil
ã¨false
ã¯ãå½ãã¨ãã¾ãã
ããã¦ãã以å¤ã®å
¨é¨ã®å¤ããçãã¨ãã¾ãã4
åç´æå¿«ï¼ï¼ã·ã³ãã«ï¼ï¼
ããããã§å ¨ä½ã説æããããã®ãã¼ãã®èª¬æãæãã¾ãããã¾ã¨ãã¾ãããã
ãµã³ãã«ããã°ã©ã ã®è§£èª¬
ãµã³ãã«ããã°ã©ã ãåæ²ãã¾ãã
ã¾ãã3è¡ç®ã§å¤æ°arg1
ã®ä¸ã«å¼æ°ã®ä¸çªç®ã代å
¥ãã¦ãã¾ãã
ããããã°ã©ã å®è¡æã«å¼æ°ãå
¥åãã¦ããã°ããã«ã¯ãä½ãï¼çï¼ãã代å
¥ããã¦ãããã¨ã«ãªãã¾ããéã«å¼æ°ãå
¥åããã¦ããªããã°ããnilï¼å½ï¼ãã代å
¥ããã¦ã¾ãã
4è¡ç®ã¯ãå¤æ°hosuu
ã®åæå¤ã¨ãã¦6ãè¨å®ãã¦å®ç¾©ãã¦ãã¾ããã
ããã6è¡ç®ã®ifæã¨ãã®æ¡ä»¶å¼ã§ããä»åæ¡ä»¶å¼ã«ã¯arg1
ãã¯ãããã§ããããã§ãããçãå½ãã§ifæã¯æ¡ä»¶åå²ããããã§ããã
ãå¼æ°ãå ¥åããããçãã®ä¸çãããå¼æ°ã«ä½ããå ¥åãã¦ããã°ãarg1ã¯çãªã®ã§ããthen ã endãé¨åãå®è¡ããã¾ãã
ã¤ã¾ããhosuu = arg1
ã§ãããarg1ã®å¤ãhosuuã«ä»£å
¥ãã¾ã5ã
ãã®çµæãåæå¤ã6ã ã£ãhosuuã¯ãå¼æ°ã®å¤ã«ãã£ã¦ä¸æ¸ãããã¾ããã
10è¡ç®ãæçµçã«ç»é¢ã«ã¯ãå ¥åããå¼æ°ããã®ã¾ã¾è¡¨ç¤ºããã¾ãã
ãå¼æ°ãå ¥åãããªãã£ããå½ãã®ä¸çããã¦éã«ãå¼æ°ãå ¥åãããªãã£ããarg1ã¯nilã§ããå½ãªã®ã§ãthen ã endãã¯èªã¿é£ã°ããã¦ä¸ã®è¡ã«é²ã¿ã¾ãã
ãã®çµæãåæå¤6ã ã£ãhosuuã¯æä»ãããã®ã¾ã¾ã§ãã
10è¡ç®ãæçµçã«ç»é¢ã«ã¯ãåæå¤6ããã®ã¾ã¾è¡¨ç¤ºããã¾ãã
ããã°ã©ã ã®æçµå½¢
ããã¾ã§ã®èª¬æãåæ ãã¦æ¹é ãããyuka4ãããã°ã©ã ã§ãã
便å©ã«ä½¿ãåãã¾ããããããã¦ãä¸ä¾¿ãªã¨ãããè¦ã¤ãã¾ãããã
次åã¯ãã£ã¨ä¾¿å©ã«æ¹é ãã¾ãã
-
ããã°ã©ã è¨èªã«ãã£ã¦ã¯ãä½ãä»£å ¥ãã¦ããªãå¤æ°ï¼åæåãã¦ãªãå¤æ°ï¼ã®ä¸ã«ä½ãå ¥ã£ã¦ããã®ãä¸å®ãªå ´åãããã¾ããå®éã«ä¸ãè¦ãã¾ã§ä½ãããããªãã¨ãæã£ï¼ãLuaè¨èªã§ã¯ãä½ãä»£å ¥ãã¦ããªãå¤æ°ã®ä¸èº«ã¯ãç¡ãï¼nilï¼ã¨æ±ºã¾ã£ã¦ãã¾ãã↩
-
å®éã«ã¨ã©ã¼ãèµ·ããã®ã¯ãããã«ãã®è¡ãªã®ã§ããããã®ã¨ã©ã¼ã®æ ¹æ¬çãªåå ã¯ãããããåã«ãããã¨ãå¤ããã¨ãããã¨ã¯è¦ãã¦ããã¾ããããä»åã®ä¾ã§è¨ããªãã°ãã13è¡ç®ã®ã¨ã©ã¼ã®åå ãã¯ã6è¡ç®ã§å¼æ°ãå¤æ°ã«ä»£å ¥ãã¦ããããã©ããããå¼æ°ãå ¥åãã¦ãªãã£ããã§ãã↩
-
ã³ã³ãã¥ã¼ã¿ã®ä¸çã§ã¯ãã³ã¼ãä¸ã«ãããâ¯â¯â¯ãªãã°â³â³â³ããããã¨ããæ¸ããã¦ããªãã£ãå ´åããâ¯â¯â¯ã§ã¯ãªãã¨ããã«ã¯ãä½ããã¾ããããã¤ã¾ãã³ã³ãã¥ã¼ã¿ã¯ãå½ä»¤ãããªãéãä½ãããªãã¨ããã®ãåååä½ã¨ãªãã¾ãã↩
-
nil
,false
以å¤ã®å ¨é¨ã®å¤ããçãã¨ããã®ã¯ã¨ã¦ãã·ã³ãã«ã§ãããæå¤ã¨ãããã®ã§ãããã¨ãã°æ°å¤1
ã0
ãæåå"abc"
ã¯å½ç¶ãªããçã¨ãã¦ãæåå"false"
ãçã¨ãªãã¾ãï¼"“ã§å²ãã§ããã®ããã¤ã³ãï¼ãã¾ãæååå³""
ãçã§ãï¼ããã¯ä¸èº«ã空ã£ã½ã®æååã§ç©ºæåã¨å¼ã³ã¾ãï¼ãããããï¼↩ -
ãã®çå·ãæ°å¦ã®ä¸çã«ããããçãããã®æå³ãããªãã§ãããæ°ãã¤ãã¦ï¼ããã°ã©ã è¨èªã®ä¸çã§ã¯ããarg1ã®å¤ãhosuuã«ä»£å ¥ãããã®æå³ã§ä½¿ã£ã¦ãã¾ããç´ããããã§ãããç¾å®ä¸çã£ã¦ãããªãã®ã§ããå²ãåã£ã¦è¦ãã¾ãããã↩
ã³ãã³ãã©ã¤ã³å¼æ°ã®ä¾¿å©ããä¸äººãç¥ãã¹ã
- ã¯ããã«
- ã³ãã³ãå ¥åæã«å¼æ°ãä¸ããã
- ã³ãã³ãã©ã¤ã³å¼æ°ã使ã£ããµã³ãã«ã³ã¼ã
- ãµã³ãã«ã³ã¼ãã®è©³ç´°è§£èª¬
- åºãããã¯è¨ç½®ããã°ã©ã ã«ã³ãã³ãã©ã¤ã³å¼æ°ãå©ç¨
- ããã°ã©ã å®è¡
- ãããã«
ã¯ããã«
ååã®è¨äºã§ã¯ãããã°ã©ã å ã§å¤æ°ã使ãæã®åºæ¬ãã話ãã¾ããã
å¤æ°ã£ã¦ä¾¿å©ã§ãããã
ããã°ã©ã ã®æåãå¤ããããã«ã½ã¼ã¹ã³ã¼ããä½ç®æãæ¸ãæããã®ã¯ã¨ã¦ãé¢åã§ãããå¤æ°ã使ããã¨ã§ãã½ã¼ã¹ã³ã¼ãã®å é é¨åãä¸ç®ææ¸ãæããã ãã§ãããªãã¾ããã
ããã¯å°ããªä¸æ©ã§ãããªããã大ããªé²æ©ã§ãããã¾ãã
ããããããããæ¯åããã°ã©ã ãæ¸ãæããã®ã£ã¦é¢åãããªãã§ããï¼
ããã§ä»åã®ã話ã§ããã¾ãã¯ä½ãããããã®ãç®æ¨ã示ãã¾ãããã
ã³ãã³ãå ¥åæã«å¼æ°ãä¸ããã
ããã¾ã§ãããã°ã©ã ãå®è¡ããã¨ãã¯ããã®ããã°ã©ã åãã³ãã³ãï¼å½ä»¤ï¼ã¨ãã¦ä¸ãã¦ãã¾ããã
ãã¨ãã°ãyukaãã¨ããããã°ã©ã ãªãã°ãã¿ã¼ããã«ç»é¢ã§æ¬¡ã®ããã«ã³ãã³ããå ¥åãã¦å®è¡ãã¦ãã¾ããã
> yuka
ã§ãããããªæãã§å®è¡ã§ããã便å©ãããªãã§ããï¼
ã16æ©åã®åºãããã¯ãæ·ããªããã
> yuka 16
ãããã¯ãã100æ©åã®åºãããã¯ãæ·ããªããã
> yuka 100
ãã®ããã«ãã³ãã³ãå ¥åæã«ãã®æéãã®ãã©ã¡ã¼ã¿ï¼å¤ï¼ãä¸ããããã°ã©ã å ã§ãã®ãã©ã¡ã¼ã¿ã¼ãå©ç¨ããã®ã§ãã
ã¡ãªã¿ã«ããã®ãã³ãã³ãå ¥åæã«ããã°ã©ã ã«æ¸¡ããã®å ´éãã®ãã©ã¡ã¼ã¿ãããã³ãã³ãã©ã¤ã³å¼æ°ãã¨ããã§ã¯å¼ã³ã¾ãã
ã¤ã¾ããã³ãã³ãã©ã¤ã³å¼æ°ã使ã£ãããã°ã©ã ã®æ¸ãæ¹ãä»åã®ãã¼ãã§ãã
ã³ãã³ãã©ã¤ã³å¼æ°ã使ã£ããµã³ãã«ã³ã¼ã
使ãããªãã«ã¯å°ãã ãã³ããå¿ è¦ã§ãã ã§ããã ãã·ã³ãã«ã«èª¬æããããã«ã次ã®ãããªã³ã¼ããç´¹ä»ãã¾ãããã
-- hikisuu0 local arg = ... print(arg)
ãããç解ããã«ã¯ãå®éã®æåã確ãããã®ãä¸çªããhikisuu0ãã¨ããããã°ã©ã åã§ãã¡ã¤ã«ä¿åãã¦ãè²ã å®è¡ãã¦ã¿ã¾ãããã
ãã¨ãã°ããããªå¼æ°ãä¸ãã¦æ°åå®è¡ãã¦ã¿ã¾ãã
> hikisuu0 100 100
> hikisuu0 abc abc
> hikisuu0 1 2 3 4 1
> hikisuu0 a b c d a
> hikisuu0 ã
以ä¸ããããããã¨ã¯ããã®ããã°ã©ã ã¯ä¸ããã³ãã³ãã©ã¤ã³å¼æ°ã®ãã¡ä¸çªç®ã®ãã®ã ããç»é¢ã«è¡¨ç¤ºããã¨ãããã¨ã§ãããã ãå¼æ°ãä½ãä¸ããªãã¨ä½ã表示ãã¾ããã
ãµã³ãã«ã³ã¼ãã®è©³ç´°è§£èª¬
ä¸è¨ã®ãµã³ãã«ã³ã¼ãããã®ã¾ã¾ã³ããããã°ãã®ã¾ã¾ããªãã®ããã°ã©ã ã«ä½¿ãããããªã®ã§ãããããªãã§ï¼ã©ãããçå±ã§ãããªãã®ï¼ãã¨æãã¾ãããï¼ãã®çåã«æãæ°æã¡ã¯éè¦ã§ããç§ã¯å°éãã¾ããï¼èå³ãªã人ã¯ãã®ç« ãèªã¿é£ã°ãã¦ãOKï¼
詳細ã«è§£èª¬ãã¾ãããã
ã¾ã注ç®ããã®ã¯1è¡ç®ã®local arg = ...
ã§ãã
åºæ¬çãªå½¢ããlocal å¤æ°å = å¤
ã®å½¢ããã¦ãããã¨ãããå¤æ°arg 1ã®å®ç¾©ããã¦ããã¨æ¨æ¸¬ã§ããã¯ãã§ããã§ã¯...
ã¨ã¯ä½ã§ããããã
Luaè¨èªã§ã¯...
ã¨ããããªãªã3ã¤ã®è¡¨è¨ããå¯å¤é·å¼æ°å¼ãã¨å¼ã³ã¾ãããã®è©³ãã説æã¯ããã§ã¯çç¥ãã¾ããããã®3ã¤ã®ç¹ã ãã§ã³ãã³ãå
¥åæã«å¾ãã«ç¶ãã¦å
¥åãããã©ã¡ã¼ã¿ï¼ã³ãã³ãã©ã¤ã³å¼æ°ï¼ãå©ç¨ã§ããããã§ããã
ãªãã...
ã¨ãã表è¨ã«ãã£ã¦ãå
¥åããã³ãã³ãã©ã¤ã³å¼æ°ã®å
¨é¨ãå©ç¨ã§ãã¾ãããã¨ãã°4ã¤å
¥åããã4ã¤ã¨ãã§ãã
ããããlocal arg = ...
ã¨ãã表è¨ã§ã¯ãå
¥åããã³ãã³ãã©ã¤ã³å¼æ°ã®ãã¡å
é ã®1åããå©ç¨ã§ãã¾ãããä»åã¯ããã§åé¡ãªãã®ã§ãããããããããã4ã¤ã®å¼æ°ãå
¥åãããã¨ãããã£ã¦ãã¦ããã®4ã¤å
¨ã¦ãæ¾ã£ã¦ä½¿ãããã®ãªãã°ã次ã®ãããªè¡¨è¨ãå¿
è¦ã§ãã
local arg1, arg2, arg3, arg4 = ...
ã¤ã¾ãä»£å ¥ç¨ã®å¤æ°ãããããã4ã¤ç¨æãã¦ããããã§ãããã¡ãªã¿ã«ãããããããªè¤æ°ã®å¤æ°ã¸ã®ä»£å ¥ãä¸æ¬ã§è¡ã表è¨ã®ãã¨ããå¤éä»£å ¥ã2ã¨å¼ã³ã¾ãã
ã¨ã¯ããå ã»ã©ãè¨ãã¾ããããä»åã¯å¤éä»£å ¥ã¯ä½¿ãã¾ãããã ã£ã¦ä»åã¯ãå¼æ°ã¯å é ã®ä¸ã¤ã ãã§ããã®ã§ãããã
åºãããã¯è¨ç½®ããã°ã©ã ã«ã³ãã³ãã©ã¤ã³å¼æ°ãå©ç¨
ãã¦ãã³ãã³ãã©ã¤ã³å¼æ°ã使ã£ã¦ãååã®ããã°ã©ã ãyuka2ãã次ã®ããã«æ¹é ãã¾ããã
å¤æ´ç¹ãããã¾ãï¼
---------------------------------- -- yuka3: åºã«ãããã¯ãè¨ç½®ããï¼1å¾å¾©ï¼ ---------------------------------- ------- Config ------- local hosuu = ... ------- Main ------- -- å°é¢ã«ç½®ããã¿ã¼ãã«ã§ã¯åºã«ãããã¯ç½®ããªãã®ã§ãæµ®ããã turtle.up() -- åºã«ãããã¯ãæ·ãè©°ããªããæå®ããæ©æ°ã ãåã«é²ã for i=1,hosuu do turtle.placeDown() turtle.forward() end -- å³ã®åã«ç§»å turtle.turnRight() turtle.forward() -- å³ã®åã®ã¹ã¿ã¼ãå°ç¹ã«ç§»åããã¡ãå´ãåãã¦ããã turtle.turnRight() turtle.forward() -- å³ã®åã«åºãããã¯ãæ·ãè©°ããªããæ»ã£ã¦ãã for i=1,hosuu do turtle.placeDown() turtle.forward() end
å®ã¯ãååã®ãyuka2ãããã°ã©ã ã«æ¯ã¹ãã¨ä¸ç®æããå¤ãã£ã¦ãªããã§ãã
- ãyuka2ãã®6è¡ç®:
local hosuu = 6
- ãyuka3ãã®6è¡ç®:
local hosuu = ...
ããã ãï¼
ããã°ã©ã å®è¡
次ã®ãããªã³ãã³ããå ¥åãã¦æåã確èªãã¾ãããã
> yuka3 6
> yuka3 16
ãããã«
ããã§ã¿ã¼ãã«ã«ãæè»ã«åºè²¼ãããã¦ãããã¾ããï¼ãã¬ããåºè²¼ãï¼ï¼ãã¶ã¼ã¨ãã§ï¼
次åã¯ããã®ããã°ã©ã ã®åé¡ç¹ã«ã¤ãã¦è§¦ãããã®æ¹åããã¾ãã
å®éã«ä½¿ãã¯ãããã¨ãã®ãã¡æ°ã¥ãåé¡ç¹ãªã®ã§ããã»ã»ã»ãããããã£ãããã³ã¡ã³ãã«æ¸ãã¦ã¿ã¦ãã ãããã
-
å¤æ°åargã®ç±æ¥ã¯ãè±èªã®argumentï¼å¼æ°ï¼ã§ãããã®ãããªã³ãã³ãã©ã¤ã³å¼æ°ã示ãå¤æ°åã¨ãã¦ãã使ãããã®ã§è¦ãã¦ããã¨è²ã æãã¾ãã↩
-
ãã¨ãã°ãããªè¡¨è¨ã§å¤éä»£å ¥ãã§ããã®ã§ããããã®å¤æ°ãä¸æ¬ã§å®ç¾©ãããã¨ãã¯ä¾¿å©ã§ãã
local x, y, z = 1, 2, 3
↩
å¤æ°ã使ãããªãã¦ããã°ã©ã ãæ¹åããã
- ã¯ããã«
- åºè²¼ãããã°ã©ã ï¼1å¾å¾©ï¼
- ãã®ããã°ã©ã ã®åé¡ç¹
- å¤æ°ã£ã¦ãªãã ã£ãï¼
- å¤æ°ã®ä½¿ãæ¹
- å¤æ°ã使ã£ã¦ããã°ã©ã ãæ¹åãã
- 次åã®ã話
ã¯ããã«
CCããã°ã©ãã³ã°ã®ç°å¢ã®è¨å®ã®è©±ã§è¨äºãæ¸ãå§ããããã¡ãã¸ã®è±ç·ãé·ããªã£ã¦ãã¾ãã¾ããã
ä»åãããæ¬æ ¼çã«CCããã°ã©ãã³ã°ãã£ã¦ããã¾ãã
ã¾ãã¯åºã«ãããã¯ãè¨ç½®ããããã°ã©ã ãåæ²ãã¾ãããã
åºè²¼ãããã°ã©ã ï¼1å¾å¾©ï¼
---------------------------------- -- yuka1: åºã«ãããã¯ãè¨ç½®ããï¼1å¾å¾©ï¼ ---------------------------------- -- å°é¢ã«ç½®ããã¿ã¼ãã«ã§ã¯åºã«ãããã¯ç½®ããªãã®ã§ãæµ®ããã turtle.up() -- åºã«ãããã¯ãæ·ãè©°ããªãã6æ©ååã«é²ã for i=1,6 do turtle.placeDown() turtle.forward() end -- å³ã®åã«ç§»å turtle.turnRight() turtle.forward() -- å³ã®åã®ã¹ã¿ã¼ãå°ç¹ã«ç§»åããã¡ãå´ãåãã¦ããã turtle.turnRight() turtle.forward() -- å³ã®åã«åºãããã¯ãæ·ãè©°ããªããæ»ã£ã¦ãã for i=1,6 do turtle.placeDown() turtle.forward() end
å¤é¨ã¨ãã£ã¿ï¼VSCodeï¼ä½¿ãã¨ãã®ãããªã³ã¼ãï¼ã½ã¼ã¹ã³ã¼ãã®ç¥ï¼ãè²åãããã¦è¦ãããã§ãããã ãªãããã£ãããªã®ã§1è¡ç®ã3è¡ç®ã®ããã«ããã®ããã°ã©ã ã®ååã¨ãã®èª¬æã«ã¤ãã¦ãæ¸ãã¦ã¿ã¾ããã ãyuka1ãã ãã§ã¯ä½ãããããã°ã©ã ãªã®ãããããªããªãã¾ããããã®ãããªã³ã¡ã³ãã¯éè¦ã§ãã
ä¸è¨ã®ã³ã¼ããã¨ãã£ã¿å´ã«ã³ãã¼ï¼ãã¼ã¹ããã§ããã®ã§ãæ¸ãã®ã楽ã«ãªãã¾ãã ã§ãã§ããã°ãä¸è¨ã³ã¼ããè¦ãªããã§ãã¾ããªãã®ã§ãã¿ã¼ãã«ã®è¡åãé ã®ä¸ã§ã·ãã¥ã¬ã¼ã·ã§ã³ããªããèªåã§ã³ã¼ããæ¸ãã¦ã¿ã¦ãã ãããã1
ãã®ããã°ã©ã ã®åé¡ç¹
ãã¦ããã®ããã°ã©ã ãªããªã便å©ãªã®ã§ããåé¡ç¹ãããã¾ãã ããã¯ã6æ©åã®ãããã¯ãè¨ç½®ãããã¨æ±ºãæã¡ã§ã³ã¼ãä¸ã«æ¸ãã¦ãããã¨ã§ãã
å ´åã«ãã£ã¦ã¯ãã10æ©ã«ããããã100æ©ãããä½è£ãã13kmãããªã©ã¨å¤æ´ãããã¨ããããã¾ãããã ããããã¨ãã¯ãããããã«ãã®ãyuka1ãããã°ã©ã ãæ¸ãæããæ¹æ³ãããã¾ãã
該å½ããé¨åã¯ã9è¡ç®ã¨23è¡ç®ã®äºç®æã§ããç¹°ãè¿ãforæã®ã«ã¦ã³ã¿ã®çµç«¯å¤ãã6ãã«ãªã£ã¦ããã®ã§ããã好ããªå¤ã«æ¸ãæããã°è¯ãããã§ãã
ãã ãæ°ãã¤ããªãã¦ã¯ãªããªãã®ã¯ã9è¡ç®ã¨23è¡ç®ã®ä¸¡æ¹ãåãå¤ã«ããªãã¨ã¿ã¼ãã«ãããããªæåã«ãªã£ã¦ãã¾ããã¨ã§ãããã¨ãã°ã100æ©å ã«é²ãã ã«ãé¢ãããã6æ©ããæ»ã£ã¦ããªãã®ã§ã¯ããããã§ãããã
ãã®ããã°ã©ã ã使ã£ã¦ããã¨ããäºç®æãæ¸ãæããã®é¢åããããåãæ°åã«ããªãã¨ãããªããï¼ãã¨æãããããã¾ããã
ããã§ã³ã¼ãã®æ¹åã§ããï¼
å¤æ°ã£ã¦ãªãã ã£ãï¼
å¦æ ¡ã®æ°å¦ã®æéã§ã¯ãxãyã®ãããªå¤æ°ãç¿ã£ããã¨ãããããããã¾ããã æ§ã ãªå¤ï¼æ°å¤ãªã©ï¼ãå¤æ°ã«ä»£å ¥ã§ããã2ãã¾ããããã¯ç¹å®ã®å¤ã®ä»£ããã«å¤æ°ã§ç½®ãæãããã¨ãã§ããã3ã¨ãå¤æ°ã¯æ°å¦ã®ä¸çã§ã¯ã¨ã¦ãå¼·åãªéå ·ã§ãã
ããã°ã©ãã³ã°ã§ãå¤æ°ã¯å©ç¨ã§ãã¾ããæ°å¦ã®æéã¨ç°ãªãã®ã¯ãå¤æ°ã«èªåã§å¥½ããªååãã¤ãã¦ãããã¨ã§ãã4ãããããããxã»yã»zã§ã¯ãªããä»äººãã¿ã¦ããããããå¤æ°åãã¤ãããã¨ãç©æ¥µçã«æ¨å¥¨ããã¦ãã¾ãã
å¤æ°ã®ä½¿ãæ¹
以ä¸ã¯ããã°ã©ã ä¸ã«å¤æ°ã®ä½¿ãæ¹ã説æããããã®ãµã³ãã«ã³ã¼ãã§ãã
local x = 3 -- ãã¼ã«ã«å¤æ°xã®å¤ã¯3ã¨å®ç¾©ãã¾ã print(x+5) -- x+5ã®å¤ã表示ããªãã
1è¡ç®ã§ãå¤æ°xã®å¤ã¯3ã§ããã¨ãå®ç¾©ããã¦ãã¾ãããlocalãã£ã¦ãªãã«ï¼ã¨æãããããã¾ããããããã¯ãã¼ã«ã«å¤æ°ï¼ä»ã®æ®µéã§ã¯ãããã ãã§ä½¿ããä¸æçãªå¤æ°ãã¨èª¬æãã¦ããã¾ãããã詳ããç¥ããããªãã°ããå¤æ°ã®ã¹ã³ã¼ãããã°ãã¼ãã«å¤æ°ããããã®ãã¼ã¯ã¼ãã§èªåã§èª¿ã¹ã¦ã¿ã¾ãããï¼ãå®ç¾©ããããã®æ§æã§ãï¼ãã¼ã«ã«ï¼å¤æ°ã使ãããã¨ãã«ã¯ãæåã«å¿ ãããæ¸ãã¦å®ç¾©ããªãã¦ã¯ãªãã¾ããã
ããã§æ³¨æãã¦æ¬²ããã®ããlocal x = 3
ã®ãï¼ãã¯ãæ°å¦ã®æéã®ãçå·ï¼ãã®æå³ã§ä½¿ã£ã¦ããªããã¨ã§ãããããä¸çã§æåã«ããã°ã©ã è¨èªãçºæãã人ã®æ大ã®ãã¹ã ã¨å人çã«æã£ã¦ãã¾ã5ã
ããã§ã®ãï¼ãã¯ãisããããã®æå³ã ã¨æã£ã¦ãã ããã
ã¤ã¾ãããx = 3ãã¯ãx is 3ï¼xã¯3ã¨ãã¾ãï¼ããããã®æå³ããªããã®ãããªç´°ãããã¨ã説æãããã¨è¨ãã¨ã次ã®ãããªãµã³ãã«ã³ã¼ããè¦ããã¨ãæ°å¦ãå¾æãªäººã»ã©æ··ä¹±ãã¦ãã¾ãã®ã§ããã
local x = 3 -- å¤æ°xã®å¤ã¯3ã¨å®ç¾©ãã¾ã print(x+5) -- x+5ã®å¤ã表示ããªãã x=1 -- å¤æ°xã®å¤ã1ã«ãã¾ãï¼å¤æ´ãã¾ãï¼ print(x+5) -- x+5ã®å¤ã表示ããªãã
æ°å¦å¾æãã³ãx=3ãªãã§ããï¼ããªãã§x=1ã¨ãè¨ãå§ããã®ããããããã§ããï¼ã
ãããã¾ããå¦æ ¡ã§ããã°ã©ãã³ã°æè²ãã£ã¦ããããã ãã©ãç®æ°ã»æ°å¦ã®ææ¥ã¨ã®æ´åæ§ï¼ï¼ã¯çå·ã§ããï¼ï¼ã¯ã©ããã£ã¦ããã®ãã»ã»ã»ãç¾å ´ã®è¦å´ãå²ã°ãã¾ãã
ç®æ°ã»æ°å¦ã®æéã§ã¯ãã=ãã¯çå·ã§ãããx=3ãã¯ãxã¯3ã¨çãããã¨ããæå³ã ãã©ãããã°ã©ãã³ã°ã®ä¸çã§ã¯ã=ãã¯ãisããããã®æå³ã§ãããx=3ãã¯ãï¼ããã§ã¯ï¼xã¯3ã¨ãã¾ãããããã®æå³ã§ããä¸çãå¤ããã¨è¨å·ã®æå³ãå¤ããã®ã§ãã
ãã®ãµã³ãã«ã³ã¼ãã¯ã1è¡ç®ããé ã«ç´ ç´ã«è§£éãã¦ããã¾ãããã
- 1è¡ç®ã¯ã
local
ã¨ã¤ãã¦ããã®ã§ï¼ãã¼ã«ã«ï¼å¤æ°xãå®ç¾©ãã¦ãã¾ããã - 2è¡ç®ã§ãã®ãã¼ã«ã«å¤æ°xã使ã£ãè¨ç®çµæãç»é¢ã«è¡¨ç¤ºãã¾ãã
- 4è¡ç®ã§å¤æ°xã®å¤ã1ã«å¤ãã¾ã
- 5è¡ç®ã§ãã®ãã¼ã«ã«å¤æ°xã使ã£ãè¨ç®çµæãç»é¢ã«è¡¨ç¤ºãã¾ãã
ãã®ããã°ã©ã ã®å®è¡çµæã¯æ¬¡ã®ããã«ç»é¢ã«è¡¨ç¤ºããã¾ãã
8 6
å¤æ°ã使ã£ã¦ããã°ã©ã ãæ¹åãã
ã¯ããé·ã ã¨ã話ãã¾ããã
å½åã®ç®çã¯ãæ©æ°ã®å¤ãäºç®æãæ¸ãæããã®ãããã©ããªã®ã§ãå¤æ°ã使ããã¨ã§å°ã楽ãã§ããããã«ãããã¨ããã話ã§ããã
以ä¸ã«çµè«ã¨ãªãã³ã¼ããç´¹ä»ãã¾ãã
---------------------------------- -- yuka2: åºã«ãããã¯ãè¨ç½®ããï¼1å¾å¾©ï¼ ---------------------------------- local hosuu = 6 -- å°é¢ã«ç½®ããã¿ã¼ãã«ã§ã¯åºã«ãããã¯ç½®ããªãã®ã§ãæµ®ããã turtle.up() -- åºã«ãããã¯ãæ·ãè©°ããªãã6æ©ååã«é²ã for i=1,hosuu do turtle.placeDown() turtle.forward() end -- å³ã®åã«ç§»å turtle.turnRight() turtle.forward() -- å³ã®åã®ã¹ã¿ã¼ãå°ç¹ã«ç§»åããã¡ãå´ãåãã¦ããã turtle.turnRight() turtle.forward() -- å³ã®åã«åºãããã¯ãæ·ãè©°ããªããæ»ã£ã¦ãã for i=1,hosuu do turtle.placeDown() turtle.forward() end
注ç®ãã¦æ¬²ããã®ã¯ã4è¡ç®ã®local hosuu = 6
ã§ãããå¤æ°hosuuãã³ã¼ãã®å
é ã§å®ç¾©ãã¦ããããã®å¤æ°hosuuã以éã®ç¹°ãè¿ãforæã®çµç«¯å¤ã¨ãã¦ä½¿ã£ã¦ãã¾ãã
ãã®ããã6æ©ãã10æ©ã«å¤ãããã®ãªããlocal hosuu = 6
ãlocal hosuu = 10
ã®ããã«æ¸ãæããã ãã§å®äºã¨ãªãã¾ãã
ã³ã¼ãã®å é ã®æ°åãå¤ããã ãOKãªã®ã§ãã¡ãã£ã¨æ¥½ã«ãªãã¾ãããã
ãã®ããã«ãããã°ã©ã ã®æåãå¤ããå¤ï¼ãã¨ãã°ä»åã®ã移åããæ©æ°ãªã©ï¼ã®ãã¨ããã©ã¡ã¼ã¿ã¼ã¨å¼ã¶å ´åãããã¾ãããã®ãããªãã©ã¡ã¼ã¿ã¼ã¯ã使ç¨ããéã«æ¸ãæãããã¨ãå¤ãã®ã§ãããã¦ãã¯ã³ã¼ãã®å é ã«æ¸ãã¦ãããã¨ãå¤ãã§ãã
ãããæ示çã«ãããããç§ã¯æ¬¡ã®ãããªæ¸ãæ¹ããã¾ããã©ãã§ããï¼ã³ã¼ãèªä½ã¯é·ããªã£ããã©ãã¿ããããªã£ã¦ãã¾ããï¼
---------------------------------- -- yuka2: åºã«ãããã¯ãè¨ç½®ããï¼1å¾å¾©ï¼ ---------------------------------- ------- Config ------- local hosuu = 6 ------- Main ------- -- å°é¢ã«ç½®ããã¿ã¼ãã«ã§ã¯åºã«ãããã¯ç½®ããªãã®ã§ãæµ®ããã turtle.up() -- åºã«ãããã¯ãæ·ãè©°ããªãã6æ©ååã«é²ã for i=1,hosuu do turtle.placeDown() turtle.forward() end -- å³ã®åã«ç§»å turtle.turnRight() turtle.forward() -- å³ã®åã®ã¹ã¿ã¼ãå°ç¹ã«ç§»åããã¡ãå´ãåãã¦ããã turtle.turnRight() turtle.forward() -- å³ã®åã«åºãããã¯ãæ·ãè©°ããªããæ»ã£ã¦ãã for i=1,hosuu do turtle.placeDown() turtle.forward() end
ã¤ã¾ãã------- Config -------
以éã¯ãã©ã¡ã¼ã¿ãè¨å®ããé¨åã§ããæåãå¤ããã¨ãã¯æ¸ãæãã¦ãã ãããã
------- Main -------
以éã¯ããã°ã©ã ã®ã¡ã¤ã³é¨åãããã以éãæ¸ãæããã¨ãã¯æ°ãã¤ãã¦ã
ä»å¾ããã®æ¹éã§ãµã³ãã«ã³ã¼ããç´¹ä»ãã¦ããã¾ãã®ã§ãæ¿ç¥ãã ããã
次åã®ã話
使ããã³ã«ã³ã¼ããäºç®æãæ¸ãæãããã¨ã«è¾æã¨ãã¦ããhevohevoã¯ãå¤æ°ã使ãæ¹å¼ã«æ¸ãæãããã¨ã§å°ã楽ã«ãªãã®ã ã£ããã ã人éã®æ¬²æã¨ã¯å°½ããªããã®ã
ãæ¯åæ¸ãæããã®é¢åã«ãªãã¾ãã(^p^)ã
ãã®ãããªããã©ããããããããã°ã©ãã³ã°ãã¥ã¼ããªã¢ã«ãå®çµã§ããã®ãã次ã®æ´æ°æ¥ã¯ãã¤ã«ãããããã¥ã¼ããªã¢ã«ãªã®ã«æç« å¤ããããã
次åãã³ãã³ãã©ã¤ã³å¼æ°ã®ä½¿ãæ¹ããä¹ããæå¾ ã
-
ãã§ã«ãæ°ã¥ãããããã¾ããããComputerCraftå ã®
edit
ã³ãã³ãï¼CCå ã¨ãã£ã¿ï¼ã§ã¯ã³ãã¼ï¼ãã¼ã¹ãã®æ©è½ãå¶éããã¦ãã¾ããããã¯CCã®ä½è ã§ããDan200æ°ã«ããæå³çãªãã®ã§ãããããããæ¢åã®ã³ã¼ããæèåæ¢ç¶æ ã§ã³ãã¼ï¼ãã¼ã¹ãããã®ã§ãªãã§ããã ãèããªããèªåã§ããã°ã©ãã³ã°ãã¦æ¬²ããã¨ããDan200æ°ã®ææ³ï¼é¡ãï¼ã§ããããã¾ãç§ãã¡ã¯å¤é¨ã¨ãã£ã¿ã使ãã®ã§ãã®å¶éã¯æå³ããªãã®ã§ããã©ããããããDan200æ°ã®é¡ãã§ããããèããªããèªåã§ããã°ã©ãã³ã°ãã«ã¤ãã¦ã¯å®å ¨ã«åæãã¾ãããã®ãã¼ã¸ãèªãã§ãçãããããã°ããï¼↩ -
ãxã¯3ã§ããx+5ã¯ããã¤ã«ãªãã§ããããï¼ããªã©↩
-
ã(x+3)2+2(x+3)+1=0ãã®æ¹ç¨å¼ã§(x+3)ãAã¨ããã¨ãA2+2A+1=0ã¨ãªãã¾ããããããã¨ã»ã»ã»ï¼ä»¥ä¸ç¥ï¼ã↩
-
æ°å¦ã®éä¸è¨ç®ã§ãå¤æ°åã¨ãã¦x/y/z/X/Y/Zã ãã§ã¯ç©è¶³ããªããªã£ã¦ãâ¡ãâ³ã®ãããªè¨å·ä½¿ã£ããã¨ããã¾ãï¼åã¯ããã¾ããåºæ¥å¿ã§ã(x+3)ãâã¨ãããã¨å°ãã¹ãã§ããããããã©ãã£ããã¨ãã«ããããã¾ããããããã¿ãå人ã«ã¯ç¬ããããã©ã↩
-
ã¡ãªã¿ã«ã2ã¤ã®å¤ãçãããã©ããã調ã¹ãã¨ãã¯ãLuaãå«ãããã¦ãã®ããã°ã©ãã³ã°è¨èªã¯
x == 3
ã¨ãã表è¨ã使ãã¾ãï¼==
ãçå·æ¼ç®åã¨å¼ã³ã¾ãï¼ããããå°å¦æ ¡ã§ããæããã¨çµ¶å¯¾æ··ä¹±ããã¨æããããã°ã©ãã³ã°è¨èªã«ãã£ã¦ã¯ãã®ãããã®åé¡ç¹ã«å¯¾å¿ããããããå¤æ°ã®å®ç¾©ã«local x := 3
ã®ãããªè¡¨è¨ã使ããå ´åãããã¾ãã↩