Jump to content

ramasser des dominos 4*


adrénalice
Go to solution Solved by Shrex,

Recommended Posts

Hello, 

Quelqu'un a un programme qui marche pour le niveau 4* de ramasser des dominos, mon robot capte pas le "or" 

 

 

from robot import *
for loop in range (3):
    for loop in range (10) :
        avancer()
        if not (surCroix() and surCroix()) or (surEtoile() and surEtoile()) or (surCarre()and surCarre()) :
            ramasserDomino()
    tournerDroite()
    tournerDroite()
    for loop in range (10) : 
        avancer()
    tournerGauche()
    avancer()
    tournerGauche()

 

En gros là y'a que les 2 croix qu'il ramasse pas

 

Merciii pour votre aide

 

 

Edit : c'est la Partie 1 de "ramasser des dominos"

Edited by jePASSparla
Link to comment
Share on other sites

  • Solution

Yo,

 

from robot import *
for loop in range(3):
    for loop in range(10):
        avancer()
        if surCarre() and (surCroix() or surEtoile()): 
            ramasserDomino()
        elif surCroix() and surEtoile(): 
            ramasserDomino()
    tournerDroite()
    tournerDroite()
    for loop in range(10):
        avancer()
    tournerGauche()
    avancer()
    tournerGauche()

 

Edit J'écrivais une réponse pour trouver le pb dans ton programme mais@DuTACKauTac est trop rapide !!!

Edited by Lynk
Link to comment
Share on other sites

  • Ancien du Bureau

Salut!

Je pense que c'est parce que ton "not" porte sur une seule condition.

Je te propose d'essayer en rentrant ça:

if not (surCroix() and surCroix()) or not (surEtoile() and surEtoile()) or not (surCarre()and surCarre()) :

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...