Projects

We will put the details of your Programming Project at this link later in the quarter

 

 

 

 

 

 

 

 

 

 

 

 

 

def goodcode(gc):
    #compare fcode with gcode and see if you get fb
    print gc
    cd=""
    for p in range(4):
        if fcode[p]==gc[p]:
            cd=cd+"1"
            gc[p]="1"
    print "after matches",gc,fcode
    for q in range(4):
        if gc[q]!="1":
            for x in range(4):
                if fcode[q]==gc[x]:
                    cd=cd+"0"
                    gc[x]="0"
                    break
    print cd,gc
               
               

 

##fcode = "rggb"
##print "first guess",fcode
##fb =input("enter response")
##acode = "rgbywc"
##for a in acode:
##for b in acode:
##    for c in acode:
##        for d in acode:
##            gcode = [a,b,c,d]
##            print "before call",gcode

fcode="rggb"
while 1:
    gcode = []
    val = raw_input("enter code")
    for x in val:
        gcode.append(x)
    print "before call",gcode
    goodcode(gcode)