Paso 1: Hazlo
¿Qué es?
Juega a este clásico juego con dos micro:bits y aprende a la vez sobre selección, variables y números aleatorios.
Estos dos vídeos te enseñarán qué vas a hacer y cómo programarlo:
Introducción
Guía de programación
Cómo funciona
- Piedra, papel y tijeras es un juego clásico de azar para dos personas. Tú y un compañero agitan los puños 3 veces y luego haces gestos al azar para mostrar una piedra, papel o tijera. La piedra gana a las tijeras, las tijeras al papel y el papel a la piedra (¡envolviéndola!)
- 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.
Qué necesitas
- 2 micro:bits (o simulador MakeCode)
- Editor de MakeCode o de Python
- pilas (opcional)
- a partner to play with
Paso 2: Prográmalo
Paso 3: Mejóralo
- 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.