1단계: 만들어 보세요.
프로젝트 소개
2 개의 micro:bit 로 게임을 하면서, 조건/선택 실행, 변수, 랜덤 값에 대해 배워보세요.
다음 동영상을 통해 만들고 프로그래밍하는 방법을 살펴보세요.:
소개
프로그래밍 가이드
설명
- 가위, 바위, 보는 두 사람이 함께 할 수 있는 간단한 게임입니다. 이기고 지는 것은 운에 따라 달라집니다. You and a partner shake your fists 3 times and then make gestures at random to show a rock, paper or scissors. Rock beats scissors, scissors beat paper and paper beats rock (it wraps the rock!).
- When the micro:bit accelerometer detects a shake movement, it sets the variable tool to a random number: 0, 1 or 2.
- We use 0 because computers start counting at 0, and it’s good to remember that 0 is a number!
- The program uses selection to decide what image to show on the LED display. If the random number was 0, it shows a rock icon, if it was 1 it shows the icon representing paper. If it wasn’t 0 or 1, it must be 2 because we instructed the micro:bit to only pick random numbers between 0 and 2, so in that case it shows scissors.
준비물
- micro:bit (또는 MakeCode 시뮬레이터) 2개
- MakeCode 또는 Python 편집기
- AAA 배터리 팩 (옵션)
- a partner to play with
2단계: 프로그래밍 해보세요.
3단계: 더 좋게 만들어 보세요.
- Draw your own icons for rock, paper, scissors.
- Think of other tools that could replace rock, paper and scissors or invent new rules.
- Use the micro:bit radio function to make a game that knows if you won or lost by communicating with your friend’s micro:bit.
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.