From 565e405ad0df8d3c360cfc9c335dbacfcc3041c0 Mon Sep 17 00:00:00 2001 From: ErfanThinker Date: Sat, 4 Jul 2020 11:32:32 +0430 Subject: [PATCH 1/2] Removed redundant condition --- ch16/circuitTests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ch16/circuitTests.py b/ch16/circuitTests.py index 5e139b6..1f53295 100644 --- a/ch16/circuitTests.py +++ b/ch16/circuitTests.py @@ -53,8 +53,7 @@ def create_gene(index, gates, sources): if gateType[1].input_count() > 0: indexA = random.randint(0, index) if gateType[1].input_count() > 1: - indexB = random.randint(0, index) \ - if index > 1 and index >= len(sources) else 0 + indexB = random.randint(0, index) if indexB == indexA: indexB = random.randint(0, index) return Node(gateType[0], indexA, indexB) From 2359440659559fae56b156fe30320b5f5f9a77ee Mon Sep 17 00:00:00 2001 From: handcraftsman Date: Tue, 7 Jul 2020 07:36:56 -0500 Subject: [PATCH 2/2] make ErfanThinker's change in the Spanish version --- es/ch16/pruebas.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/es/ch16/pruebas.py b/es/ch16/pruebas.py index d11f6a8..03a1a8d 100644 --- a/es/ch16/pruebas.py +++ b/es/ch16/pruebas.py @@ -53,8 +53,7 @@ def crear_gen(índice, puertas, fuentes): if tipoDePuerta[1].recuento_de_entradas() > 0: índiceA = random.randint(0, índice) if tipoDePuerta[1].recuento_de_entradas() > 1: - índiceB = random.randint(0, índice) \ - if índice > 1 and índice >= len(fuentes) else 0 + índiceB = random.randint(0, índice) if índiceB == índiceA: índiceB = random.randint(0, índice) return Nodo(tipoDePuerta[0], índiceA, índiceB)