Hello, Need Help With This Mastermind Game Error
HarryPall (0)

How To Fix The Cyclomatic = Too High Error:
My Code Up Until Now:

import random
guesses = 0
Randint1 = random.randint(1,11)
Randint2 = random.randint(1,11)
Randint3 = random.randint(1,11)
Randint4 = random.randint(1,11)
while guesses < 6:
guess1 = input(1,11) # cyclomatic error too high
guess2 = input(1,11)
guess3 = input(1,11)
guess4 = input(1,11)
guess1 = int(guess1)
guess2 = int(guess2)
guess3 = int(guess3)
guess4 = int(guess4)

This Part Is For The Guesses That Are Right And In Right Order

if guess1 == Randint1:
print ("BLACK")
if guess2 == Randint2:
print ("BLACK")
if guess3 == Randint3:
print ("BLACK")
if guess4 == Randint4:
print ("BLACK")

This Part Is For The Number Guesses That Are Right But In Wrong Order (1st Number)

if guess1 == Randint2:
print ("WHITE")
if guess1 == Randint3:
print ("WHITE")
if guess1 == Randint4:
print ("WHITE")

This Part Is For The Number Guesses That Are Right But In Wrong Order (2nd Number)

if guess2 == Randint1:
print ("WHITE")
if guess2 == Randint3:
print ("WHITE")
if guess2 == Randint4:
print ("WHITE")

This Part Is For The Number Guesses That Are Right But In Wrong Order (3rd Number)

if guess3 == Randint1:
print ("WHITE")
if guess3 == Randint2:
print ("WHITE")
if guess3 == Randint4:
print ("WHITE")

This Part Is For The Number Guesses That Are Right But In Wrong Order (4st Number)

if guess4 == Randint1:
print ("WHITE")
if guess4 == Randint2:
print ("WHITE")
if guess4 == Randint3:
print ("WHITE")

This Part Is For The Number Guesses That Are Neither Right Nor In The Right Position

else:
print ("RED")

You are viewing a single comment. View All