BBC MICROBIT - PIERRE FEUILLE CISEAUX
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- BBC MICROBIT : PROJET -
PIERRE FEUILLE CISEAUX
- - - - - - - - - - - - - - - - - - - -
- PRÉSENTATION -
Jouez au chifoumi contre votre BBC Microbit.
Choisissez entre pierre, feuille ciseaux.
Appuyez sur le bouton A ou B du BBC Microbit.
Une flèche vous indique le choix aléatoire du BBC Microbit
- - - - - - - - - - - - - - - - - - - -
- MATÉRIEL -
BBC MICROBIT [1] - v1 ou v2
FEUILLE [1] - A4 - blanche - 160 gr
- - - - - - - - - - - - - - - - - - - -
- PREPARATION -
Imprimez le modèle.
Coupez les éléments.
Marquez les plis.
Collez les éléments.
Rangez les éléments du jeu dans le boitier.
- - - - - - - - - - - - - - - - - - - -
- PROGRAMMATION -
Branchez votre BBC Microbit sur un port USB.
Ouvrez IDE préféré et saisissez le script suivant.
Ou faites un copier / coller.
# --- Origine Nerd ---
# --- Mon atelier a moi ---
# --- BBC Microbit ---
# --- CHIFOUMI 01 ---
# --- IMPORTATION DES MODULES ---
import microbit , random
# --- INITIALISATION GENERALE ---
# --- Création des images ---
IMG_Pierre = microbit.Image ( "90000:09000:00900:00090:00000" )
IMG_Ciseaux = microbit.Image ( "00900:00900:00900:00900:00000" )
IMG_Feuille = microbit.Image ( "00009:00090:00900:09000:00000" )
# --- BOUCLE PRINCIPALE ---
while True :
kchoix = random.randint ( 0 , 2 )
# --- Teste si un des boutons est enfoncé ---
if microbit.button_a.is_pressed ( ) or microbit.button_b.is_pressed ( ) :
# --- Animation ---
for i in range ( random.randint ( 5 , 10 ) ) :
microbit.display.show ( IMG_Pierre )
microbit.sleep ( 75 )
microbit.display.show ( IMG_Ciseaux )
microbit.sleep ( 75 )
microbit.display.show ( IMG_Feuille )
microbit.sleep ( 75 )
microbit.display.show ( IMG_Ciseaux )
microbit.sleep ( 75 )
kchoix = random.randint ( 0 , 2 )
microbit.display.clear ( )
microbit.sleep ( 350 )
# --- Affichage du choix aléatoire ---
kchoix = random.randint ( 0 , 2 )
if kchoix == 0 :
microbit.display.show ( IMG_Pierre )
elif kchoix == 1 :
microbit.display.show ( IMG_Ciseaux )
else :
microbit.display.show ( IMG_Feuille )
microbit.sleep ( 100 )
# --- Pause ---
for kled in range ( 5 ) :
microbit.display.set_pixel ( kled , 4 , 9 )
microbit.sleep ( 100 )
for kled in range ( 5 ) :
microbit.display.set_pixel( kled , 4 , 0 )
microbit.sleep ( 100 )
# --- Programme : JFB ---
# --- Janvier 2020 ---
# --- Fin ---
Téléversez ou flashez le script dans votre BBC Microbit.
Déconnectez et débranchez votre BBC Microbit.
- - - - - - - - - - - - - - - - - - - -
- UTILISATION -
Branchez l'alimentation du BBC Microbit.
Sortez les éléments du jeu du boitier.
Replacez l'étui dans le fond du boitier.
Introduisez le BBC Microbit dans le boitier.
Fermez le boitier et jouez.
FÉLICITATION !
C'est terminé.
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -



Commentaires
Enregistrer un commentaire