Jump to content

Recommended Posts

Posted

salut je ne comprends pas pq mon programme compte qu'une fois les dominos et j'ai réussi à rectifier mais ça me fais 36 block de plus.

```

from robot import *
nbrCa=0
nbrE=0
nbrCr=0
for loop in range(8): 
    avancer() 
    if surCarre() and surCroix(): 
        nbrCa=nbrCa+1
        nbrCr=nbrCr+1
    if surCarre() and surEtoile(): 
        nbrCa=nbrCa+1 
        nbrE=nbrE+1 
    if surCarre and surCarre: 
        nbrCa=nbrCa+2 
    if surEtoile() and surEtoile(): 
        nbrE=nbrE+2 
    if surEtoile() and surCroix(): 
        nbrE=nbrE+1 
        nbrCr=nbrCr+1 
    if surCroix() and surCroix(): 
        nbrCr=nbrCr+2 
avancer() 
avancer() 
if nbrCa > (nbrE and nbrCr): 
    ecrireNombre(nbrCa) 
if nbrCr >(nbrE and nbrCa): 
    ecrireNombre(nbrCr) 
if nbrE >(nbrCa and nbrCr): 
    ecrireNombre(nbrE) ```

celui la c'est celui qui à 36 block de plus normalement il fonctionne mais du coup il a trop de block de plus 

https://ibb.co/kVXdp7gH

https://ibb.co/z3xC7pg

Merciii

  • 2 weeks later...
  • Ancien Responsable Matière
Posted

Salut @letartare06, je ne sais pas si tu as réussi depuis, mais il est vrai que cet exercice est vraiment dur et limité en blocs. Je te laisse mon programme qui fait pile 70 blocs :

ca=0
et=0
cr=0
for i in range(9):
    avancer()
    if surCarre():
        ca+=1
        if not (surCroix() or surEtoile()):
            ca+=1
    if surCroix():
        cr+=1
        if not (surCarre() or surEtoile()):
            cr+=1
    if surEtoile():
        et+=1
        if not (surCarre() or surCroix()):
            et+=1    
avancer()
a=et
if a < ca :
    a = ca
if a < cr :
    a = cr
ecrireNombre(a)

 

N'hésite pas si tu as des questions !

Posted (edited)
il y a 24 minutes, Bastitine a dit :

Salut @letartare06, je ne sais pas si tu as réussi depuis, mais il est vrai que cet exercice est vraiment dur et limité en blocs. Je te laisse mon programme qui fait pile 70 blocs :

ca=0
et=0
cr=0
for i in range(9):
    avancer()
    if surCarre():
        ca+=1
        if not (surCroix() or surEtoile()):
            ca+=1
    if surCroix():
        cr+=1
        if not (surCarre() or surEtoile()):
            cr+=1
    if surEtoile():
        et+=1
        if not (surCarre() or surCroix()):
            et+=1    
avancer()
a=et
if a < ca :
    a = ca
if a < cr :
    a = cr
ecrireNombre(a)

 

N'hésite pas si tu as des questions !

Oui j'avais réussi mais Merciii bcp quand même 

 

Edited by letartare06

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...