Jump to content
Sign in to follow this  
NielsvGorsel

Can someone please check this code?

Recommended Posts

Hello guys, i have been making the game called 'MasterMind'. I am allmost finished with the project but i do have one weird error left.I made the code in the program named 'NetBeans'. The problem is: If I fill in the 6th circle on the 10x4 screen where you can guess the solution. I cannot fill in the circels further, but if i keep choosing the same color i do can full in all colors. The problem is quite hard to explain. So here is the Javascript code, please use the code to help me solve my error. Thanks! :) - The code is quite long, but i do need a lot of codes to discribe the mastermind game for myself. I know it could be done shorter but I do not require the skills to make that happen! ;) ~ Many Thanks Niels ----------------- The Java Code -------------------- /** Main.fx** Created on 18-apr-2012, 10:23:10*/ package mastermind; import javafx.scene.Scene;import javafx.stage.Stage;import javafx.scene.shape.Rectangle;import javafx.scene.paint.Color;import javafx.scene.control.Button;import javafx.scene.shape.Circle;import java.lang.Math;import javafx.scene.input.MouseEvent;import javafx.scene.Group;import javafx.scene.text.Text;import javafx.scene.text.Font;import javafx.scene.text.*;import javafx.scene.paint.*;import javafx.scene.shape.Line; /*** @author Nielz*/var stage:Stage;var scene:Scene;var checkbutton:Button;var nieuwbutton:Button;var afsluitbutton:Button;var wintext:Text;var randomnummer1 = Math.random();var randomnummer2 = Math.random();var randomnummer3 = Math.random();var randomnummer4 = Math.random();var kleur1 = Color.RED;var kleur2 = Color.MAGENTA;var kleur3 = Color.BLUE;var kleur4 = Color.GREEN;var yellowcircle:Circle; var magentacircle:Circle; var redcircle:Circle; var bluecircle:Circle; var greencircle:Circle; var orangecircle:Circle; var rij1:Group; var rij2:Group; var rij3:Group; var rij4:Group;var rij5:Group;var rij6:Group; var rij7:Group; var rij8:Group; var rij9:Group; var rij10:Group; var c1r1:Circle; var c2r1:Circle; var c3r1:Circle; var c4r1:Circle; var c1r2:Circle; var c2r2:Circle; var c3r2:Circle; var c4r2:Circle; var c1r3:Circle; var c2r3:Circle; var c3r3:Circle; var c4r3:Circle; var c1r4:Circle; var c2r4:Circle; var c3r4:Circle; var c4r4:Circle; var c1r5:Circle; var c2r5:Circle; var c3r5:Circle; var c4r5:Circle; var c1r6:Circle; var c2r6:Circle; var c3r6:Circle; var c4r6:Circle; var c1r7:Circle; var c2r7:Circle; var c3r7:Circle; var c4r7:Circle; var c1r8:Circle; var c2r8:Circle; var c3r8:Circle; var c4r8:Circle; var c1r9:Circle; var c2r9:Circle; var c3r9:Circle; var c4r9:Circle; var c1r10:Circle; var c2r10:Circle; var c3r10:Circle; var c4r10:Circle; //de kleine cirkels var k1r1:Circle; var k2r1:Circle; var k3r1:Circle; var k4r1:Circle; var k1r2:Circle; var k2r2:Circle; var k3r2:Circle; var k4r2:Circle; var k1r3:Circle; var k2r3:Circle; var k3r3:Circle; var k4r3:Circle; var k1r4:Circle; var k2r4:Circle; var k3r4:Circle; var k4r4:Circle; var k1r5:Circle; var k2r5:Circle; var k3r5:Circle; var k4r5:Circle; var k1r6:Circle; var k2r6:Circle; var k3r6:Circle; var k4r6:Circle; var k1r7:Circle; var k2r7:Circle; var k3r7:Circle; var k4r7:Circle; var k1r8:Circle; var k2r8:Circle; var k3r8:Circle; var k4r8:Circle; var k1r9:Circle; var k2r9:Circle; var k3r9:Circle; var k4r9:Circle; var k1r10:Circle;var k2r10:Circle;var k3r10:Circle; var k4r10:Circle; //de eigenlijke variabelen die de kleur van de cirkels boolean maakt omdat je not niet samen met Color.WHITE kan gebruiken var c1r1wit:Boolean; var c2r1wit:Boolean; var c3r1wit:Boolean; var c4r1wit:Boolean; var k1r1wit:Boolean; var k2r1wit:Boolean; var k3r1wit:Boolean; var k4r1wit:Boolean; var c1r2wit:Boolean; var c2r2wit:Boolean; var c3r2wit:Boolean; var c4r2wit:Boolean; var k1r2wit:Boolean; var k2r2wit:Boolean; var k3r2wit:Boolean; var k4r2wit:Boolean; var c1r3wit:Boolean; var c2r3wit:Boolean; var c3r3wit:Boolean; var c4r3wit:Boolean; var k1r3wit:Boolean; var k2r3wit:Boolean; var k3r3wit:Boolean; var k4r3wit:Boolean; var c1r4wit:Boolean; var c2r4wit:Boolean; var c3r4wit:Boolean; var c4r4wit:Boolean; var k1r4wit:Boolean; var k2r4wit:Boolean; var k3r4wit:Boolean; var k4r4wit:Boolean; var c1r5wit:Boolean; var c2r5wit:Boolean; var c3r5wit:Boolean; var c4r5wit:Boolean; var k1r5wit:Boolean; var k2r5wit:Boolean; var k3r5wit:Boolean; var k4r5wit:Boolean; var c1r6wit:Boolean; var c2r6wit:Boolean; var c3r6wit:Boolean; var c4r6wit:Boolean; var k1r6wit:Boolean; var k2r6wit:Boolean; var k3r6wit:Boolean; var k4r6wit:Boolean; var c1r7wit:Boolean; var c2r7wit:Boolean; var c3r7wit:Boolean; var c4r7wit:Boolean; var k1r7wit:Boolean; var k2r7wit:Boolean; var k3r7wit:Boolean; var k4r7wit:Boolean; var c1r8wit:Boolean; var c2r8wit:Boolean; var c3r8wit:Boolean; var c4r8wit:Boolean; var k1r8wit:Boolean; var k2r8wit:Boolean; var k3r8wit:Boolean; var k4r8wit:Boolean; var c1r9wit:Boolean; var c2r9wit:Boolean; var c3r9wit:Boolean; var c4r9wit:Boolean; var k1r9wit:Boolean; var k2r9wit:Boolean; var k3r9wit:Boolean; var k4r9wit:Boolean; var c1r10wit:Boolean;var c2r10wit:Boolean;var c3r10wit:Boolean;var c4r10wit:Boolean; var k1r10wit:Boolean;var k2r10wit:Boolean;var k3r10wit:Boolean;var k4r10wit:Boolean; //de code die de kleur van de invulcirkels (c1r1-c4r10)en de controle cirkels (k1r1-k4r10) boolean maaktif(c1r1.fill == Color.WHITE){c1r1wit = true}if(c2r1.fill == Color.WHITE){c2r1wit = true}if(c3r1.fill == Color.WHITE){c3r1wit = true}if(c4r1.fill == Color.WHITE){c4r1wit = true} if(c1r2.fill == Color.WHITE){c1r2wit = true}if(c2r2.fill == Color.WHITE){c2r2wit = true}if(c3r2.fill == Color.WHITE){c3r2wit = true}if(c4r2.fill == Color.WHITE){c4r2wit = true} if(c1r3.fill == Color.WHITE){c1r3wit = true}if(c2r3.fill == Color.WHITE){c2r3wit = true}if(c3r3.fill == Color.WHITE){c3r3wit = true}if(c4r3.fill == Color.WHITE){c4r3wit = true} if(c1r4.fill == Color.WHITE){c1r4wit = true}if(c2r4.fill == Color.WHITE){c2r4wit = true}if(c3r4.fill == Color.WHITE){c3r4wit = true}if(c4r4.fill == Color.WHITE){c4r4wit = true} if(c1r5.fill == Color.WHITE){c1r5wit = true}if(c2r5.fill == Color.WHITE){c2r5wit = true}if(c3r5.fill == Color.WHITE){c3r5wit = true}if(c4r5.fill == Color.WHITE){c4r5wit = true} if(c1r6.fill == Color.WHITE){c1r6wit = true}if(c2r6.fill == Color.WHITE){c2r6wit = true}if(c3r6.fill == Color.WHITE){c3r6wit = true}if(c4r6.fill == Color.WHITE){c4r6wit = true} if(c1r7.fill == Color.WHITE){c1r7wit = true}if(c2r7.fill == Color.WHITE){c2r7wit = true}if(c3r7.fill == Color.WHITE){c3r7wit = true}if(c4r7.fill == Color.WHITE){c4r7wit = true} if(c1r8.fill == Color.WHITE){c1r8wit = true}if(c2r8.fill == Color.WHITE){c2r8wit = true}if(c3r8.fill == Color.WHITE){c3r8wit = true}if(c4r8.fill == Color.WHITE){c4r8wit = true} if(c1r9.fill == Color.WHITE){c1r9wit = true}if(c2r9.fill == Color.WHITE){c2r9wit = true}if(c3r9.fill == Color.WHITE){c3r9wit = true}if(c4r9.fill == Color.WHITE){c4r9wit = true} if(c1r10.fill == Color.WHITE){c1r10wit = true}if(c2r10.fill == Color.WHITE){c2r10wit = true}if(c3r10.fill == Color.WHITE){c3r10wit = true}if(c4r10.fill == Color.WHITE){c4r10wit = true}//hier begint het gedeelte voor de kleine cirkelsif(k1r1.fill == Color.WHITE){k1r1wit = true}if(k2r1.fill == Color.WHITE){k2r1wit = true}if(k3r1.fill == Color.WHITE){k3r1wit = true}if(k4r1.fill == Color.WHITE){k4r1wit = true} if(k1r2.fill == Color.WHITE){k1r2wit = true}if(k2r2.fill == Color.WHITE){k2r2wit = true}if(k3r2.fill == Color.WHITE){k3r2wit = true}if(k4r2.fill == Color.WHITE){k4r2wit = true} if(k1r3.fill == Color.WHITE){k1r3wit = true}if(k2r3.fill == Color.WHITE){k2r3wit = true}if(k3r3.fill == Color.WHITE){k3r3wit = true}if(k4r3.fill == Color.WHITE){k4r3wit = true} if(k1r4.fill == Color.WHITE){k1r4wit = true}if(k2r4.fill == Color.WHITE){k2r4wit = true}if(k3r4.fill == Color.WHITE){k3r4wit = true}if(k4r4.fill == Color.WHITE){k4r4wit = true} if(k1r5.fill == Color.WHITE){k1r5wit = true}if(k2r5.fill == Color.WHITE){k2r5wit = true}if(k3r5.fill == Color.WHITE){k3r5wit = true}if(k4r5.fill == Color.WHITE){k4r5wit = true} if(k1r6.fill == Color.WHITE){k1r6wit = true}if(k2r6.fill == Color.WHITE){k2r6wit = true}if(k3r6.fill == Color.WHITE){k3r6wit = true}if(k4r6.fill == Color.WHITE){k4r6wit = true} if(k1r7.fill == Color.WHITE){k1r7wit = true}if(k2r7.fill == Color.WHITE){k2r7wit = true}if(k3r7.fill == Color.WHITE){k3r7wit = true}if(k4r7.fill == Color.WHITE){k4r7wit = true} if(k1r8.fill == Color.WHITE){k1r8wit = true}if(k2r8.fill == Color.WHITE){k2r8wit = true}if(k3r8.fill == Color.WHITE){k3r8wit = true}if(k4r8.fill == Color.WHITE){k4r8wit = true} if(k1r9.fill == Color.WHITE){k1r9wit = true}if(k2r9.fill == Color.WHITE){k2r9wit = true}if(k3r9.fill == Color.WHITE){k3r9wit = true}if(k4r9.fill == Color.WHITE){k4r9wit = true} if(k1r10.fill == Color.WHITE){k1r10wit = true}if(k2r10.fill == Color.WHITE){k2r10wit = true}if(k3r10.fill == Color.WHITE){k3r10wit = true}if(k4r10.fill == Color.WHITE){k4r10wit = true}//de randomkleuringen van kleur 1/*if((randomnummer1*6)>0 and (randomnummer1*6)<=1){ kleur1 =Color.MAGENTA }if((randomnummer1*6)>1 and (randomnummer1*6)<=2){ kleur1 = Color.RED }if((randomnummer1*6)>2 and (randomnummer1*6)<=3){ kleur1 =Color.BLUE }if((randomnummer1*6)>3 and (randomnummer1*6)<=4){ kleur1 = Color.GREEN }if((randomnummer1*6)>4 and (randomnummer1*6)<=5){ kleur1 =Color.ORANGE }if((randomnummer1*6)>5 and (randomnummer1*6)<=6){ kleur1 = Color.YELLOW } //de randomkleurgen voor kleur2if((randomnummer2*6)>0 and (randomnummer2*6)<=1){ kleur2 =Color.MAGENTA }if((randomnummer2*6)>1 and (randomnummer2*6)<=2){ kleur2 = Color.RED }if((randomnummer2*6)>2 and (randomnummer2*6)<=3){ kleur2 =Color.BLUE }if((randomnummer2*6)>3 and (randomnummer2*6)<=4){ kleur2 = Color.GREEN }if((randomnummer2*6)>4 and (randomnummer2*6)<=5){ kleur2 =Color.ORANGE }if((randomnummer2*6)>5 and (randomnummer2*6)<=6){ kleur2 = Color.YELLOW }//de randomkleurgen voor kleur3if((randomnummer3*6)>0 and (randomnummer3*6)<=1){ kleur3 =Color.MAGENTA }if((randomnummer3*6)>1 and (randomnummer3*6)<=2){ kleur3 = Color.RED }if((randomnummer3*6)>2 and (randomnummer3*6)<=3){ kleur3 =Color.BLUE }if((randomnummer3*6)>3 and (randomnummer3*6)<=4){ kleur3 = Color.GREEN }if((randomnummer3*6)>4 and (randomnummer3*6)<=5){ kleur3 =Color.ORANGE }if((randomnummer3*6)>5 and (randomnummer3*6)<=6){ kleur3 = Color.YELLOW } //de randomkleurgen voor kleur4if((randomnummer4*6)>0 and (randomnummer4*6)<=1){ kleur4 =Color.MAGENTA }if((randomnummer4*6)>1 and (randomnummer4*6)<=2){ kleur4 = Color.RED }if((randomnummer4*6)>2 and (randomnummer4*6)<=3){ kleur4 =Color.BLUE }if((randomnummer4*6)>3 and (randomnummer4*6)<=4){ kleur4 = Color.GREEN }if((randomnummer4*6)>4 and (randomnummer4*6)<=5){ kleur4 =Color.ORANGE }if((randomnummer4*6)>5 and (randomnummer4*6)<=6){ kleur4 = Color.YELLOW }*/var regel1zwart:Number;var regel2zwart:Number;var regel3zwart:Number;var regel4zwart:Number;var regel5zwart:Number;var regel6zwart:Number;var regel7zwart:Number;var regel8zwart:Number;var regel9zwart:Number;var regel10zwart:Number;var regel1grijs:Number;var regel2grijs:Number;var regel3grijs:Number;var regel4grijs:Number;var regel5grijs:Number;var regel6grijs:Number;var regel7grijs:Number;var regel8grijs:Number;var regel9grijs:Number;var regel10grijs:Number;regel1zwart=0;regel2zwart=0;regel3zwart=0;regel4zwart=0;regel5zwart=0;regel6zwart=0;regel7zwart=0;regel8zwart=0;regel9zwart=0;regel10zwart=0;regel1grijs=0;regel2grijs=0;regel3grijs=0;regel4grijs=0;regel5grijs=0;regel6grijs=0;regel7grijs=0;regel8grijs=0;regel9grijs=0;regel10grijs=0; stage = Stage {title : "MASTERMIND" scene: scene = Scene {width: 750height: 750 fill: Color.TANcontent: [ //het speelveld Rectangle { x: 50 y: 50 width: 300 height: 540 arcWidth: 25 arcHeight: 25 stroke: Color.BLACK fill: LinearGradient { startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0, proportional: true stops: [ Stop {offset: 0.0 color: Color.BROWN}, Stop {offset: 1.0 color: Color.CHOCOLATE} ] } } //de knop om te controleren checkbutton = Button { translateX: 100 translateY: 650 width:150 text: "controleer code" action: function() { //functie om de code te checken regel1zwart=0;regel2zwart=0;regel3zwart=0;regel4zwart=0;regel5zwart=0;regel6zwart=0;regel7zwart=0;regel8zwart=0;regel9zwart=0;regel10zwart=0; regel1grijs=0;regel2grijs=0;regel3grijs=0;regel4grijs=0;regel5grijs=0;regel6grijs=0;regel7grijs=0;regel8grijs=0;regel9grijs=0;regel10grijs=0; if(c1r1.fill == Color.WHITE){c1r1wit = true} if(c2r1.fill == Color.WHITE){c2r1wit = true} if(c3r1.fill == Color.WHITE){c3r1wit = true} if(c4r1.fill == Color.WHITE){c4r1wit = true} if(c1r2.fill == Color.WHITE){c1r2wit = true} if(c2r2.fill == Color.WHITE){c2r2wit = true} if(c3r2.fill == Color.WHITE){c3r2wit = true} if(c4r2.fill == Color.WHITE){c4r2wit = true} if(c1r3.fill == Color.WHITE){c1r3wit = true} if(c2r3.fill == Color.WHITE){c2r3wit = true} if(c3r3.fill == Color.WHITE){c3r3wit = true} if(c4r3.fill == Color.WHITE){c4r3wit = true} if(c1r4.fill == Color.WHITE){c1r4wit = true} if(c2r4.fill == Color.WHITE){c2r4wit = true} if(c3r4.fill == Color.WHITE){c3r4wit = true} if(c4r4.fill == Color.WHITE){c4r4wit = true} if(c1r5.fill == Color.WHITE){c1r5wit = true} if(c2r5.fill == Color.WHITE){c2r5wit = true} if(c3r5.fill == Color.WHITE){c3r5wit = true} if(c4r5.fill == Color.WHITE){c4r5wit = true} if(c1r6.fill == Color.WHITE){c1r6wit = true} if(c2r6.fill == Color.WHITE){c2r6wit = true} if(c3r6.fill == Color.WHITE){c3r6wit = true} if(c4r6.fill == Color.WHITE){c4r6wit = true} if(c1r7.fill == Color.WHITE){c1r7wit = true} if(c2r7.fill == Color.WHITE){c2r7wit = true} if(c3r7.fill == Color.WHITE){c3r7wit = true} if(c4r7.fill == Color.WHITE){c4r7wit = true} if(c1r8.fill == Color.WHITE){c1r8wit = true} if(c2r8.fill == Color.WHITE){c2r8wit = true} if(c3r8.fill == Color.WHITE){c3r8wit = true} if(c4r8.fill == Color.WHITE){c4r8wit = true} if(c1r9.fill == Color.WHITE){c1r9wit = true} if(c2r9.fill == Color.WHITE){c2r9wit = true} if(c3r9.fill == Color.WHITE){c3r9wit = true} if(c4r9.fill == Color.WHITE){c4r9wit = true} if(c1r10.fill == Color.WHITE){c1r10wit = true} if(c2r10.fill == Color.WHITE){c2r10wit = true} if(c3r10.fill == Color.WHITE){c3r10wit = true} if(c4r10.fill == Color.WHITE){c4r10wit = true} //hier begint het gedeelte voor de kleine cirkels if(k1r1.fill == Color.WHITE){k1r1wit = true} if(k2r1.fill == Color.WHITE){k2r1wit = true} if(k3r1.fill == Color.WHITE){k3r1wit = true} if(k4r1.fill == Color.WHITE){k4r1wit = true} if(k1r2.fill == Color.WHITE){k1r2wit = true} if(k2r2.fill == Color.WHITE){k2r2wit = true} if(k3r2.fill == Color.WHITE){k3r2wit = true} if(k4r2.fill == Color.WHITE){k4r2wit = true} if(k1r3.fill == Color.WHITE){k1r3wit = true} if(k2r3.fill == Color.WHITE){k2r3wit = true} if(k3r3.fill == Color.WHITE){k3r3wit = true} if(k4r3.fill == Color.WHITE){k4r3wit = true} if(k1r4.fill == Color.WHITE){k1r4wit = true} if(k2r4.fill == Color.WHITE){k2r4wit = true} if(k3r4.fill == Color.WHITE){k3r4wit = true} if(k4r4.fill == Color.WHITE){k4r4wit = true} if(k1r5.fill == Color.WHITE){k1r5wit = true} if(k2r5.fill == Color.WHITE){k2r5wit = true} if(k3r5.fill == Color.WHITE){k3r5wit = true} if(k4r5.fill == Color.WHITE){k4r5wit = true} if(k1r6.fill == Color.WHITE){k1r6wit = true} if(k2r6.fill == Color.WHITE){k2r6wit = true} if(k3r6.fill == Color.WHITE){k3r6wit = true} if(k4r6.fill == Color.WHITE){k4r6wit = true} if(k1r7.fill == Color.WHITE){k1r7wit = true} if(k2r7.fill == Color.WHITE){k2r7wit = true} if(k3r7.fill == Color.WHITE){k3r7wit = true} if(k4r7.fill == Color.WHITE){k4r7wit = true} if(k1r8.fill == Color.WHITE){k1r8wit = true} if(k2r8.fill == Color.WHITE){k2r8wit = true} if(k3r8.fill == Color.WHITE){k3r8wit = true} if(k4r8.fill == Color.WHITE){k4r8wit = true} if(k1r9.fill == Color.WHITE){k1r9wit = true} if(k2r9.fill == Color.WHITE){k2r9wit = true} if(k3r9.fill == Color.WHITE){k3r9wit = true} if(k4r9.fill == Color.WHITE){k4r9wit = true} if(k1r10.fill == Color.WHITE){k1r10wit = true} if(k2r10.fill == Color.WHITE){k2r10wit = true} if(k3r10.fill == Color.WHITE){k3r10wit = true} if(k4r10.fill == Color.WHITE){k4r10wit = true} //de code die de wintext zichtbaar maakt if (c1r1.fill== kleur1 and c2r1.fill== kleur2 and c3r1.fill== kleur3 and c4r1.fill==kleur4){ wintext.visible = true } else if(c1r2.fill== kleur1 and c2r2.fill== kleur2 and c3r2.fill== kleur3 and c4r2.fill==kleur4){ wintext.visible = true } else if(c1r3.fill== kleur1 and c2r3.fill== kleur2 and c3r3.fill== kleur3 and c4r3.fill==kleur4){ wintext.visible = true } else if(c1r4.fill== kleur1 and c2r4.fill== kleur2 and c3r4.fill== kleur3 and c4r4.fill==kleur4){ wintext.visible = true } else if(c1r5.fill== kleur1 and c2r5.fill== kleur2 and c3r5.fill== kleur3 and c4r5.fill==kleur4){ wintext.visible = true } else if(c1r6.fill== kleur1 and c2r6.fill== kleur2 and c3r6.fill== kleur3 and c4r6.fill==kleur4){ wintext.visible = true } else if(c1r7.fill== kleur1 and c2r7.fill== kleur2 and c3r7.fill== kleur3 and c4r7.fill==kleur4){ wintext.visible = true } else if(c1r8.fill== kleur1 and c2r8.fill== kleur2 and c3r8.fill== kleur3 and c4r8.fill==kleur4){ wintext.visible = true } else if(c1r9.fill== kleur1 and c2r9.fill== kleur2 and c3r9.fill== kleur3 and c4r9.fill==kleur4){ wintext.visible = true } else if(c1r10.fill== kleur1 and c2r10.fill== kleur2 and c3r10.fill== kleur3 and c4r10.fill==kleur4){ wintext.visible = true } //de code om een hoeveelheid bolletjes zwart te maken if(c1r1.fill == kleur1){regel1zwart++} if(c2r1.fill == kleur2){regel1zwart++} if(c3r1.fill == kleur3){regel1zwart++} if(c4r1.fill == kleur4){regel1zwart++} if(c1r2.fill == kleur1){regel2zwart++} if(c2r2.fill == kleur2){regel2zwart++} if(c3r2.fill == kleur3){regel2zwart++} if(c4r2.fill == kleur4){regel2zwart++} if(c1r3.fill == kleur1){regel3zwart++} if(c2r3.fill == kleur2){regel3zwart++} if(c3r3.fill == kleur3){regel3zwart++} if(c4r3.fill == kleur4){regel3zwart++} if(c1r4.fill == kleur1){regel4zwart++} if(c2r4.fill == kleur2){regel4zwart++} if(c3r4.fill == kleur3){regel4zwart++} if(c4r4.fill == kleur4){regel4zwart++} if(c1r5.fill == kleur1){regel5zwart++} if(c2r5.fill == kleur2){regel5zwart++} if(c3r5.fill == kleur3){regel5zwart++} if(c4r5.fill == kleur4){regel5zwart++} if(c1r6.fill == kleur1){regel6zwart++} if(c2r6.fill == kleur2){regel6zwart++} if(c3r6.fill == kleur3){regel6zwart++} if(c4r6.fill == kleur4){regel6zwart++} if(c1r7.fill == kleur1){regel7zwart++} if(c2r7.fill == kleur2){regel7zwart++} if(c3r7.fill == kleur3){regel7zwart++} if(c4r7.fill == kleur4){regel7zwart++} if(c1r8.fill == kleur1){regel8zwart++} if(c2r8.fill == kleur2){regel8zwart++} if(c3r8.fill == kleur3){regel8zwart++} if(c4r8.fill == kleur4){regel8zwart++} if(c1r9.fill == kleur1){regel9zwart++} if(c2r9.fill == kleur2){regel9zwart++} if(c3r9.fill == kleur3){regel9zwart++} if(c4r9.fill == kleur4){regel9zwart++} if(c1r10.fill == kleur1){regel10zwart++}if(c2r10.fill == kleur2){regel10zwart++}if(c3r10.fill == kleur3){regel10zwart++}if(c4r10.fill == kleur4){regel10zwart++} //de code om een hoeveelheid bolletjes grijs te maken if(c1r1.fill == kleur2 or c1r1.fill == kleur3 or c1r1.fill == kleur4) {regel1grijs++} if(c2r1.fill == kleur1 or c2r1.fill == kleur3 or c2r1.fill == kleur4) {regel1grijs++} if(c1r2.fill == kleur2 or c1r2.fill == kleur3 or c1r2.fill == kleur4) {regel2grijs++} if(c2r2.fill == kleur1 or c2r2.fill == kleur3 or c2r2.fill == kleur4) {regel2grijs++} if(c1r3.fill == kleur2 or c1r3.fill == kleur3 or c1r3.fill == kleur4) {regel3grijs++} if(c2r3.fill == kleur1 or c2r3.fill == kleur3 or c2r3.fill == kleur4) {regel3grijs++} if(c1r4.fill == kleur2 or c1r4.fill == kleur3 or c1r4.fill == kleur4) {regel4grijs++} if(c2r4.fill == kleur1 or c2r4.fill == kleur3 or c2r4.fill == kleur4) {regel4grijs++} if(c1r5.fill == kleur2 or c1r5.fill == kleur3 or c1r5.fill == kleur4) {regel5grijs++} if(c2r5.fill == kleur1 or c2r5.fill == kleur3 or c2r5.fill == kleur4) {regel5grijs++} if(c1r6.fill == kleur2 or c1r6.fill == kleur3 or c1r6.fill == kleur4) {regel6grijs++} if(c2r6.fill == kleur1 or c2r6.fill == kleur3 or c2r6.fill == kleur4) {regel6grijs++} if(c1r7.fill == kleur2 or c1r7.fill == kleur3 or c1r7.fill == kleur4) {regel7grijs++} if(c2r7.fill == kleur1 or c2r7.fill == kleur3 or c2r7.fill == kleur4) {regel7grijs++} if(c1r8.fill == kleur2 or c1r8.fill == kleur3 or c1r8.fill == kleur4) {regel8grijs++} if(c2r8.fill == kleur1 or c2r8.fill == kleur3 or c2r8.fill == kleur4) {regel8grijs++} if(c1r9.fill == kleur2 or c1r9.fill == kleur3 or c1r9.fill == kleur4) {regel9grijs++} if(c2r9.fill == kleur1 or c2r9.fill == kleur3 or c2r9.fill == kleur4) {regel9grijs++} if(c1r10.fill == kleur2 or c1r10.fill == kleur3 or c1r10.fill == kleur4){regel10grijs++}if(c2r10.fill ==kleur1 or c2r10.fill == kleur3 or c2r10.fill == kleur4) {regel10grijs++} if(c3r1.fill == kleur1 or c3r1.fill == kleur2 or c3r1.fill == kleur4) {regel1grijs++} if(c4r1.fill == kleur1 or c4r1.fill == kleur2 or c4r1.fill == kleur3) {regel1grijs++} if(c3r2.fill == kleur1 or c3r2.fill == kleur2 or c3r2.fill == kleur4) {regel2grijs++} if(c4r2.fill == kleur1 or c4r2.fill == kleur2 or c4r2.fill == kleur3) {regel2grijs++} if(c3r3.fill == kleur1 or c3r3.fill == kleur2 or c3r3.fill == kleur4) {regel3grijs++} if(c4r3.fill == kleur1 or c4r3.fill == kleur2 or c4r3.fill == kleur3) {regel3grijs++} if(c3r4.fill == kleur1 or c3r4.fill == kleur2 or c3r4.fill == kleur4) {regel4grijs++} if(c4r4.fill == kleur1 or c4r4.fill == kleur2 or c4r4.fill == kleur3) {regel4grijs++} if(c3r5.fill == kleur1 or c3r5.fill == kleur2 or c3r5.fill == kleur4) {regel5grijs++} if(c4r5.fill == kleur1 or c4r5.fill == kleur2 or c4r5.fill == kleur3) {regel5grijs++} if(c3r6.fill == kleur1 or c3r6.fill == kleur2 or c3r6.fill == kleur4) {regel6grijs++} if(c4r6.fill == kleur1 or c2r6.fill == kleur2 or c4r6.fill == kleur3) {regel6grijs++} if(c3r7.fill == kleur1 or c3r7.fill == kleur2 or c3r7.fill == kleur4) {regel7grijs++} if(c4r7.fill == kleur1 or c2r7.fill == kleur2 or c4r7.fill == kleur3) {regel7grijs++} if(c3r8.fill == kleur1 or c3r8.fill == kleur2 or c3r8.fill == kleur4) {regel8grijs++} if(c4r8.fill == kleur1 or c4r8.fill == kleur2 or c4r8.fill == kleur3) {regel8grijs++} if(c3r9.fill == kleur1 or c3r9.fill == kleur2 or c3r9.fill == kleur4) {regel9grijs++} if(c4r9.fill == kleur1 or c4r9.fill == kleur2 or c4r9.fill == kleur3) {regel9grijs++} if(c3r10.fill == kleur1 or c3r10.fill == kleur2 or c3r10.fill == kleur4) {regel10grijs++}if(c4r10.fill ==kleur1 or c4r10.fill == kleur2 or c4r10.fill == kleur3) {regel10grijs++} //de code die de zwarte bolletjes invult if(regel1zwart ==1){k1r1.fill=Color.BLACK} if(regel1zwart ==2){k1r1.fill=Color.BLACK;k2r1.fill=Color.BLACK} if(regel1zwart ==3){k1r1.fill=Color.BLACK;k2r1.fill=Color.BLACK;k3r1.fill=Color.BLACK} if(regel1zwart ==4){k1r1.fill=Color.BLACK;k2r1.fill=Color.BLACK;k3r1.fill=Color.BLACK;k4r1.fill=Color.BLACK} if(regel2zwart ==1){k1r2.fill=Color.BLACK} if(regel2zwart ==2){k1r2.fill=Color.BLACK;k2r2.fill=Color.BLACK} if(regel2zwart ==3){k1r2.fill=Color.BLACK;k2r2.fill=Color.BLACK;k3r2.fill=Color.BLACK} if(regel2zwart ==4){k1r2.fill=Color.BLACK;k2r2.fill=Color.BLACK;k3r2.fill=Color.BLACK;k4r2.fill=Color.BLACK} if(regel3zwart ==1){k1r3.fill=Color.BLACK} if(regel3zwart ==2){k1r3.fill=Color.BLACK;k2r3.fill=Color.BLACK} if(regel3zwart ==3){k1r3.fill=Color.BLACK;k2r3.fill=Color.BLACK;k3r3.fill=Color.BLACK} if(regel3zwart ==4){k1r3.fill=Color.BLACK;k2r3.fill=Color.BLACK;k3r3.fill=Color.BLACK;k4r3.fill=Color.BLACK} if(regel4zwart ==1){k1r4.fill=Color.BLACK} if(regel4zwart ==2){k1r4.fill=Color.BLACK;k2r4.fill=Color.BLACK} if(regel4zwart ==3){k1r4.fill=Color.BLACK;k2r4.fill=Color.BLACK;k3r4.fill=Color.BLACK} if(regel4zwart ==4){k1r4.fill=Color.BLACK;k2r4.fill=Color.BLACK;k3r4.fill=Color.BLACK;k4r4.fill=Color.BLACK} if(regel5zwart ==1){k1r5.fill=Color.BLACK} if(regel5zwart ==2){k1r5.fill=Color.BLACK;k2r5.fill=Color.BLACK} if(regel5zwart ==3){k1r5.fill=Color.BLACK;k2r5.fill=Color.BLACK;k3r5.fill=Color.BLACK} if(regel5zwart ==4){k1r5.fill=Color.BLACK;k2r5.fill=Color.BLACK;k3r5.fill=Color.BLACK;k4r5.fill=Color.BLACK} if(regel6zwart ==1){k1r6.fill=Color.BLACK} if(regel6zwart ==2){k1r6.fill=Color.BLACK;k2r6.fill=Color.BLACK} if(regel6zwart ==3){k1r6.fill=Color.BLACK;k2r6.fill=Color.BLACK;k3r6.fill=Color.BLACK} if(regel6zwart ==4){k1r6.fill=Color.BLACK;k2r6.fill=Color.BLACK;k3r6.fill=Color.BLACK;k4r6.fill=Color.BLACK} if(regel7zwart ==1){k1r7.fill=Color.BLACK} if(regel7zwart ==2){k1r7.fill=Color.BLACK;k2r7.fill=Color.BLACK} if(regel7zwart ==3){k1r7.fill=Color.BLACK;k2r7.fill=Color.BLACK;k3r7.fill=Color.BLACK} if(regel7zwart ==4){k1r7.fill=Color.BLACK;k2r7.fill=Color.BLACK;k3r7.fill=Color.BLACK;k4r7.fill=Color.BLACK} if(regel8zwart ==1){k1r8.fill=Color.BLACK} if(regel8zwart ==2){k1r8.fill=Color.BLACK;k2r8.fill=Color.BLACK} if(regel8zwart ==3){k1r8.fill=Color.BLACK;k2r8.fill=Color.BLACK;k3r8.fill=Color.BLACK} if(regel8zwart ==4){k1r8.fill=Color.BLACK;k2r8.fill=Color.BLACK;k3r8.fill=Color.BLACK;k4r8.fill=Color.BLACK} if(regel9zwart ==1){k1r9.fill=Color.BLACK} if(regel9zwart ==2){k1r9.fill=Color.BLACK;k2r9.fill=Color.BLACK} if(regel9zwart ==3){k1r9.fill=Color.BLACK;k2r9.fill=Color.BLACK;k3r9.fill=Color.BLACK} if(regel9zwart ==4){k1r9.fill=Color.BLACK;k2r9.fill=Color.BLACK;k3r9.fill=Color.BLACK;k4r9.fill=Color.BLACK} if(regel10zwart ==1){k1r10.fill=Color.BLACK}if(regel10zwart ==2){k1r10.fill=Color.BLACK;k2r10.fill=Color.BLACK}if(regel10zwart ==3){k1r10.fill=Color.BLACK;k2r10.fill=Color.BLACK;k3r10.fill=Color.BLACK}if(regel10zwart ==4){k1r10.fill=Color.BLACK;k2r10.fill=Color.BLACK;k3r10.fill=Color.BLACK;k4r10.fill=Color.BLACK} //de code die nu checkt welke bolletjes nog wit zijn if(k1r1.fill == Color.WHITE){k1r1wit = true} if(k2r1.fill == Color.WHITE){k2r1wit = true} if(k3r1.fill == Color.WHITE){k3r1wit = true} if(k4r1.fill == Color.WHITE){k4r1wit = true} if(k1r2.fill == Color.WHITE){k1r2wit = true} if(k2r2.fill == Color.WHITE){k2r2wit = true} if(k3r2.fill == Color.WHITE){k3r2wit = true} if(k4r2.fill == Color.WHITE){k4r2wit = true} if(k1r3.fill == Color.WHITE){k1r3wit = true} if(k2r3.fill == Color.WHITE){k2r3wit = true} if(k3r3.fill == Color.WHITE){k3r3wit = true} if(k4r3.fill == Color.WHITE){k4r3wit = true} if(k1r4.fill == Color.WHITE){k1r4wit = true} if(k2r4.fill == Color.WHITE){k2r4wit = true} if(k3r4.fill == Color.WHITE){k3r4wit = true} if(k4r4.fill == Color.WHITE){k4r4wit = true} if(k1r5.fill == Color.WHITE){k1r5wit = true} if(k2r5.fill == Color.WHITE){k2r5wit = true} if(k3r5.fill == Color.WHITE){k3r5wit = true} if(k4r5.fill == Color.WHITE){k4r5wit = true} if(k1r6.fill == Color.WHITE){k1r6wit = true} if(k2r6.fill == Color.WHITE){k2r6wit = true} if(k3r6.fill == Color.WHITE){k3r6wit = true} if(k4r6.fill == Color.WHITE){k4r6wit = true} if(k1r7.fill == Color.WHITE){k1r7wit = true} if(k2r7.fill == Color.WHITE){k2r7wit = true} if(k3r7.fill == Color.WHITE){k3r7wit = true} if(k4r7.fill == Color.WHITE){k4r7wit = true} if(k1r8.fill == Color.WHITE){k1r8wit = true} if(k2r8.fill == Color.WHITE){k2r8wit = true} if(k3r8.fill == Color.WHITE){k3r8wit = true} if(k4r8.fill == Color.WHITE){k4r8wit = true} if(k1r9.fill == Color.WHITE){k1r9wit = true} if(k2r9.fill == Color.WHITE){k2r9wit = true} if(k3r9.fill == Color.WHITE){k3r9wit = true} if(k4r9.fill == Color.WHITE){k4r9wit = true} if(k1r10.fill == Color.WHITE){k1r10wit = true} if(k2r10.fill == Color.WHITE){k2r10wit = true} if(k3r10.fill == Color.WHITE){k3r10wit = true} if(k4r10.fill == Color.WHITE){k4r10wit = true} //de code die de de grijze bolletjes invult if(regel1grijs==1 and k1r1wit==true) {k1r1.fill=Color.GRAY}else if(regel1grijs==1 and k2r1wit==true) {k2r1.fill=Color.GRAY}else if(regel1grijs==1 and k3r1wit==true) {k3r1.fill=Color.GRAY}else if(regel1grijs==1 and k4r1wit==true) {k4r1.fill=Color.GRAY}; if(regel2grijs==1 and k1r2wit==true) {k1r2.fill=Color.GRAY}else if(regel2grijs==1 and k2r2wit==true) {k2r2.fill=Color.GRAY}else if(regel2grijs==1 and k3r2wit==true) {k3r2.fill=Color.GRAY}else if(regel2grijs==1 and k4r2wit==true) {k4r2.fill=Color.GRAY}; if(regel3grijs==1 and k1r3wit==true) {k1r3.fill=Color.GRAY}else if(regel3grijs==1 and k2r3wit==true) {k2r3.fill=Color.GRAY}else if(regel3grijs==1 and k3r3wit==true) {k3r3.fill=Color.GRAY}else if(regel3grijs==1 and k4r3wit==true) {k4r3.fill=Color.GRAY}; if(regel4grijs==1 and k1r4wit==true) {k1r4.fill=Color.GRAY}else if(regel4grijs==1 and k2r4wit==true) {k2r4.fill=Color.GRAY}else if(regel4grijs==1 and k3r4wit==true) {k3r4.fill=Color.GRAY}else if(regel4grijs==1 and k4r4wit==true) {k4r4.fill=Color.GRAY}; if(regel5grijs==1 and k1r5wit==true) {k1r5.fill=Color.GRAY}else if(regel5grijs==1 and k2r5wit==true) {k2r5.fill=Color.GRAY}else if(regel5grijs==1 and k3r5wit==true) {k3r5.fill=Color.GRAY}else if(regel5grijs==1 and k4r5wit==true) {k4r5.fill=Color.GRAY}; if(regel6grijs==1 and k1r6wit==true) {k1r6.fill=Color.GRAY}else if(regel6grijs==1 and k2r6wit==true) {k2r6.fill=Color.GRAY}else if(regel6grijs==1 and k3r6wit==true) {k3r6.fill=Color.GRAY}else if(regel6grijs==1 and k4r6wit==true) {k4r6.fill=Color.GRAY}; if(regel7grijs==1 and k1r7wit==true) {k1r7.fill=Color.GRAY}else if(regel7grijs==1 and k2r7wit==true) {k2r7.fill=Color.GRAY}else if(regel7grijs==1 and k3r7wit==true) {k3r7.fill=Color.GRAY}else if(regel7grijs==1 and k4r7wit==true) {k4r7.fill=Color.GRAY}; if(regel8grijs==1 and k1r8wit==true) {k1r8.fill=Color.GRAY}else if(regel8grijs==1 and k2r8wit==true) {k2r8.fill=Color.GRAY}else if(regel8grijs==1 and k3r8wit==true) {k3r8.fill=Color.GRAY}else if(regel8grijs==1 and k4r8wit==true) {k4r8.fill=Color.GRAY}; if(regel9grijs==1 and k1r9wit==true) {k1r9.fill=Color.GRAY}else if(regel9grijs==1 and k2r9wit==true) {k2r9.fill=Color.GRAY}else if(regel9grijs==1 and k3r9wit==true) {k3r9.fill=Color.GRAY}else if(regel9grijs==1 and k4r9wit==true) {k4r9.fill=Color.GRAY}; if(regel10grijs==1 and k1r10wit==true){k1r10.fill=Color.GRAY}else if(regel10grijs==1 and k2r10wit==true){k2r10.fill=Color.GRAY}else if(regel10grijs==1 and k3r10wit==true){k3r10.fill=Color.GRAY}else if(regel10grijs==1 and k4r10wit==true){k4r10.fill=Color.GRAY}; if(regel1grijs==2 and k1r1wit==true){k1r1.fill=Color.GREY;}else if(regel1grijs==2 and k2r1wit==true){k2r1.fill=Color.GREY;} else if(regel1grijs==2 and k3r1wit==true){k3r1.fill=Color.GREY;}else if(regel1grijs==2 and k4r1wit==true){k4r1.fill=Color.GREY;}; if(regel2grijs==2 and k1r2wit==true){k1r2.fill=Color.GREY;}else if(regel2grijs==2 and k2r2wit==true){k2r2.fill=Color.GREY;} else if(regel2grijs==2 and k3r2wit==true){k3r2.fill=Color.GREY;}else if(regel2grijs==2 and k4r2wit==true){k4r2.fill=Color.GREY;}; if(regel3grijs==2 and k1r3wit==true){k1r3.fill=Color.GREY;}else if(regel3grijs==2 and k2r3wit==true){k2r3.fill=Color.GREY;} else if(regel3grijs==2 and k3r3wit==true){k3r3.fill=Color.GREY;}else if(regel3grijs==2 and k4r3wit==true){k4r3.fill=Color.GREY;}; if(regel4grijs==2 and k1r4wit==true){k1r4.fill=Color.GREY;}else if(regel4grijs==2 and k2r4wit==true){k2r4.fill=Color.GREY;} else if(regel4grijs==2 and k3r4wit==true){k3r4.fill=Color.GREY;}else if(regel4grijs==2 and k4r4wit==true){k4r4.fill=Color.GREY;}; if(regel5grijs==2 and k1r5wit==true){k1r5.fill=Color.GREY;}else if(regel5grijs==2 and k2r5wit==true){k2r5.fill=Color.GREY;} else if(regel5grijs==2 and k3r5wit==true){k3r5.fill=Color.GREY;}else if(regel5grijs==2 and k4r5wit==true){k4r5.fill=Color.GREY;}; if(regel6grijs==2 and k1r6wit==true){k1r6.fill=Color.GREY;}else if(regel6grijs==2 and k2r6wit==true){k2r6.fill=Color.GREY;} else if(regel6grijs==2 and k3r6wit==true){k3r6.fill=Color.GREY;}else if(regel6grijs==2 and k4r6wit==true){k4r6.fill=Color.GREY;}; if(regel7grijs==2 and k1r7wit==true){k1r7.fill=Color.GREY;}else if(regel7grijs==2 and k2r7wit==true){k2r7.fill=Color.GREY;} else if(regel7grijs==2 and k3r7wit==true){k3r7.fill=Color.GREY;}else if(regel7grijs==2 and k4r7wit==true){k4r7.fill=Color.GREY;}; if(regel8grijs==2 and k1r8wit==true){k1r8.fill=Color.GREY;}else if(regel8grijs==2 and k2r8wit==true){k2r8.fill=Color.GREY;} else if(regel8grijs==2 and k3r8wit==true){k3r8.fill=Color.GREY;}else if(regel8grijs==2 and k4r8wit==true){k4r8.fill=Color.GREY;}; if(regel9grijs==2 and k1r9wit==true){k1r9.fill=Color.GREY;}else if(regel9grijs==2 and k2r9wit==true){k2r9.fill=Color.GREY;} else if(regel9grijs==2 and k3r9wit==true){k3r9.fill=Color.GREY;}else if(regel9grijs==2 and k4r9wit==true){k4r9.fill=Color.GREY;}; if(regel10grijs==2 and k1r10wit==true){k1r10.fill=Color.GREY;}else if(regel10grijs==2 and k2r10wit==true){k2r10.fill=Color.GREY;}else if(regel10grijs==2 and k3r10wit==true){k3r10.fill=Color.GREY;}else if(regel10grijs==2 and k4r10wit==true){k4r10.fill=Color.GREY;}; if(regel1grijs==3 and k1r1wit==true) {k1r1.fill=Color.GRAY;k2r1.fill=Color.GRAY;k3r1.fill=Color.GRAY;} else if(regel1grijs==3 and k2r1wit==true) {k2r1.fill=Color.GRAY;k3r1.fill=Color.GRAY;k4r1.fill=Color.GRAY;} if(regel2grijs==3 and k1r2wit==true) {k1r2.fill=Color.GRAY;k2r2.fill=Color.GRAY;k3r2.fill=Color.GRAY;} else if(regel2grijs==3 and k2r2wit==true) {k2r2.fill=Color.GRAY;k3r2.fill=Color.GRAY;k4r2.fill=Color.GRAY;} if(regel3grijs==3 and k1r3wit==true) {k1r3.fill=Color.GRAY;k2r3.fill=Color.GRAY;k3r3.fill=Color.GRAY;} else if(regel3grijs==3 and k2r3wit==true) {k2r3.fill=Color.GRAY;k3r3.fill=Color.GRAY;k4r3.fill=Color.GRAY;} if(regel4grijs==3 and k1r4wit==true) {k1r4.fill=Color.GRAY;k2r4.fill=Color.GRAY;k3r4.fill=Color.GRAY;} else if(regel4grijs==3 and k2r4wit==true) {k2r4.fill=Color.GRAY;k3r4.fill=Color.GRAY;k4r4.fill=Color.GRAY;} if(regel5grijs==3 and k1r5wit==true) {k1r5.fill=Color.GRAY;k2r5.fill=Color.GRAY;k3r5.fill=Color.GRAY;} else if(regel5grijs==3 and k2r5wit==true) {k2r5.fill=Color.GRAY;k3r5.fill=Color.GRAY;k4r5.fill=Color.GRAY;} if(regel6grijs==3 and k1r6wit==true) {k1r6.fill=Color.GRAY;k2r6.fill=Color.GRAY;k3r6.fill=Color.GREY;} else if(regel6grijs==3 and k2r6wit==true) {k2r6.fill=Color.GRAY;k3r6.fill=Color.GRAY;k4r6.fill=Color.GRAY;} if(regel7grijs==3 and k1r7wit==true) {k1r7.fill=Color.GRAY;k2r7.fill=Color.GRAY;k3r7.fill=Color.GRAY;} else if(regel7grijs==3 and k2r7wit==true) {k2r7.fill=Color.GRAY;k3r7.fill=Color.GRAY;k4r7.fill=Color.GREY;} if(regel8grijs==3 and k1r8wit==true) {k1r8.fill=Color.GRAY;k2r8.fill=Color.GRAY;k3r8.fill=Color.GRAY;} else if(regel8grijs==3 and k2r8wit==true) {k2r8.fill=Color.GRAY;k3r8.fill=Color.GRAY;k4r8.fill=Color.GRAY;} if(regel9grijs==3 and k1r9wit==true) {k1r9.fill=Color.GRAY;k2r9.fill=Color.GRAY;k3r9.fill=Color.GRAY;} else if(regel9grijs==3 and k2r9wit==true) {k2r9.fill=Color.GRAY;k3r9.fill=Color.GRAY;k4r9.fill=Color.GRAY;} if(regel10grijs==3 and k1r10wit==true){k1r10.fill=Color.GRAY;k2r10.fill=Color.GRAY;k3r10.fill=Color.GRAY;}else if(regel10grijs==3 and k2r10wit==true){k2r10.fill=Color.GRAY;k3r10.fill=Color.GRAY;k4r10.fill=Color.GRAY;} if(regel1grijs==4 and k1r1wit==true) {k1r1.fill=Color.GRAY;k2r1.fill=Color.GRAY;k3r1.fill=Color.GRAY;k4r1.fill=Color.GRAY;} if(regel2grijs==4 and k1r2wit==true) {k1r2.fill=Color.GRAY;k2r2.fill=Color.GRAY;k3r2.fill=Color.GRAY;k4r2.fill=Color.GRAY;} if(regel3grijs==4 and k1r3wit==true) {k1r3.fill=Color.GRAY;k2r3.fill=Color.GRAY;k3r3.fill=Color.GRAY;k4r3.fill=Color.GRAY;} if(regel4grijs==4 and k1r4wit==true) {k1r4.fill=Color.GRAY;k2r4.fill=Color.GRAY;k3r4.fill=Color.GRAY;k4r4.fill=Color.GRAY;} if(regel5grijs==4 and k1r5wit==true) {k1r5.fill=Color.GRAY;k2r5.fill=Color.GRAY;k3r5.fill=Color.GRAY;k4r5.fill=Color.GRAY;} if(regel6grijs==4 and k1r6wit==true) {k1r6.fill=Color.GREY;k2r6.fill=Color.GRAY;k3r6.fill=Color.GRAY;k4r6.fill=Color.GRAY;} if(regel7grijs==4 and k1r7wit==true) {k1r7.fill=Color.GRAY;k2r7.fill=Color.GRAY;k3r7.fill=Color.GRAY;k4r7.fill=Color.GRAY;} if(regel8grijs==4 and k1r8wit==true) {k1r8.fill=Color.GRAY;k2r8.fill=Color.GRAY;k3r8.fill=Color.GRAY;k4r8.fill=Color.GRAY;} if(regel9grijs==4 and k1r9wit==true) {k1r9.fill=Color.GRAY;k2r9.fill=Color.GRAY;k3r9.fill=Color.GRAY;k4r9.fill=Color.GRAY;} if(regel10grijs==4 and k1r10wit==true){k1r10.fill=Color.GRAY;k2r10.fill=Color.GRAY;k3r10.fill=Color.GRAY;k4r10.fill=Color.GRAY;} } } Rectangle {x: 460, y: 210 width: 135 height: 170arcWidth: 40 arcHeight: 40 stroke: Color.BLACKfill: LinearGradient {startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0,proportional: truestops: [stop {offset: 0.0 color: Color.LIGHTGRAY},Stop {offset: 1.0 color : Color.DARKGRAY}]}} //opnieuw knop nieuwbutton = Button { translateX: 300 translateY: 650 width:150 text: "Nieuw spel" action: function(){ randomnummer1 = Math.random(); randomnummer2 = Math.random(); randomnummer3 = Math.random(); randomnummer4 = Math.random(); regel1zwart=0;regel2zwart=0;regel3zwart=0;regel4zwart=0;regel5zwart=0;regel6zwart=0;regel7zwart=0;regel8zwart=0;regel9zwart=0;regel10zwart=0; regel1grijs=0;regel2grijs=0;regel3grijs=0;regel4grijs=0;regel5grijs=0;regel6grijs=0;regel7grijs=0;regel8grijs=0;regel9grijs=0;regel10grijs=0; //de randomkleurgen van kleur1 if((randomnummer1*6)>0 and (randomnummer1*6)<=1){ kleur1 =Color.MAGENTA } if((randomnummer1*6)>1 and (randomnummer1*6)<=2){ kleur1 = Color.RED } if((randomnummer1*6)>2 and (randomnummer1*6)<=3){ kleur1 =Color.BLUE } if((randomnummer1*6)>3 and (randomnummer1*6)<=4){ kleur1 = Color.GREEN } if((randomnummer1*6)>4 and (randomnummer1*6)<=5){ kleur1 =Color.ORANGE } if((randomnummer1*6)>5 and (randomnummer1*6)<=6){ kleur1 = Color.YELLOW } //de randomkleurgen voor kleur2 if((randomnummer2*6)>0 and (randomnummer2*6)<=1){ kleur2 =Color.MAGENTA } if((randomnummer2*6)>1 and (randomnummer2*6)<=2){ kleur2 = Color.RED } if((randomnummer2*6)>2 and (randomnummer2*6)<=3){ kleur2 =Color.BLUE } if((randomnummer2*6)>3 and (randomnummer2*6)<=4){ kleur2 = Color.GREEN } if((randomnummer2*6)>4 and (randomnummer2*6)<=5){ kleur2 =Color.ORANGE } if((randomnummer2*6)>5 and (randomnummer2*6)<=6){ kleur2 = Color.YELLOW } //de randomkleurgen voor kleur3 if((randomnummer3*6)>0 and (randomnummer3*6)<=1){ kleur3 =Color.MAGENTA } if((randomnummer3*6)>1 and (randomnummer3*6)<=2){ kleur3 = Color.RED } if((randomnummer3*6)>2 and (randomnummer3*6)<=3){ kleur3 =Color.BLUE } if((randomnummer3*6)>3 and (randomnummer3*6)<=4){ kleur3 = Color.GREEN } if((randomnummer3*6)>4 and (randomnummer3*6)<=5){ kleur3 =Color.ORANGE } if((randomnummer3*6)>5 and (randomnummer3*6)<=6){ kleur3 = Color.YELLOW } //de randomkleurgen voor kleur4 if((randomnummer4*6)>0 and (randomnummer4*6)<=1){ kleur4 =Color.MAGENTA } if((randomnummer4*6)>1 and (randomnummer4*6)<=2){ kleur4 = Color.RED } if((randomnummer4*6)>2 and (randomnummer4*6)<=3){ kleur4 =Color.BLUE } if((randomnummer4*6)>3 and (randomnummer4*6)<=4){ kleur4 = Color.GREEN } if((randomnummer4*6)>4 and (randomnummer4*6)<=5){ kleur4 =Color.ORANGE } if((randomnummer4*6)>5 and (randomnummer4*6)<=6){ kleur4 = Color.YELLOW } c1r1.fill=Color.WHITE;c1r2.fill=Color.WHITE;c1r3.fill=Color.WHITE;c1r4.fill=Color.WHITE;c1r5.fill=Color.WHITE; c1r6.fill=Color.WHITE;c1r7.fill=Color.WHITE;c1r8.fill=Color.WHITE;c1r9.fill=Color.WHITE;c1r10.fill=Color.WHITE; c2r1.fill=Color.WHITE;c2r2.fill=Color.WHITE;c2r3.fill=Color.WHITE;c2r4.fill=Color.WHITE;c2r5.fill=Color.WHITE; c2r6.fill=Color.WHITE;c2r7.fill=Color.WHITE;c2r8.fill=Color.WHITE;c2r9.fill=Color.WHITE;c2r10.fill=Color.WHITE; c3r1.fill=Color.WHITE;c3r2.fill=Color.WHITE;c3r3.fill=Color.WHITE;c3r4.fill=Color.WHITE;c3r5.fill=Color.WHITE; c3r6.fill=Color.WHITE;c3r7.fill=Color.WHITE;c3r8.fill=Color.WHITE;c3r9.fill=Color.WHITE;c3r10.fill=Color.WHITE; c4r1.fill=Color.WHITE;c4r2.fill=Color.WHITE;c4r3.fill=Color.WHITE;c4r4.fill=Color.WHITE;c4r5.fill=Color.WHITE; c4r6.fill=Color.WHITE;c4r7.fill=Color.WHITE;c4r8.fill=Color.WHITE;c4r9.fill=Color.WHITE;c4r10.fill=Color.WHITE; k1r1.fill=Color.WHITE;k1r2.fill=Color.WHITE;k1r3.fill=Color.WHITE;k1r4.fill=Color.WHITE;k1r5.fill=Color.WHITE; k1r6.fill=Color.WHITE;k1r7.fill=Color.WHITE;k1r8.fill=Color.WHITE;k1r9.fill=Color.WHITE;k1r10.fill=Color.WHITE; k2r1.fill=Color.WHITE;k2r2.fill=Color.WHITE;k2r3.fill=Color.WHITE;k2r4.fill=Color.WHITE;k2r5.fill=Color.WHITE; k2r6.fill=Color.WHITE;k2r7.fill=Color.WHITE;k2r8.fill=Color.WHITE;k2r9.fill=Color.WHITE;k2r10.fill=Color.WHITE; k3r1.fill=Color.WHITE;k3r2.fill=Color.WHITE;k3r3.fill=Color.WHITE;k3r4.fill=Color.WHITE;k3r5.fill=Color.WHITE; k3r6.fill=Color.WHITE;k3r7.fill=Color.WHITE;k3r8.fill=Color.WHITE;k3r9.fill=Color.WHITE;k3r10.fill=Color.WHITE; k4r1.fill=Color.WHITE;k4r2.fill=Color.WHITE;k4r3.fill=Color.WHITE;k4r4.fill=Color.WHITE;k4r5.fill=Color.WHITE; k4r6.fill=Color.WHITE;k4r7.fill=Color.WHITE;k4r8.fill=Color.WHITE;k4r9.fill=Color.WHITE;k4r10.fill=Color.WHITE; wintext.visible = false } } //de kleurencirkels magentacircle = Circle { centerX: 500, centerY: 245 radius: 22.5 strokeWidth: 5.0 stroke: Color.BLACK fill: Color.MAGENTA onMouseClicked: function (e: MouseEvent): Void { //de code om te bepalen of en welke cirkels roze moeten worden if(c1r1.fill == Color.WHITE){ c1r1.fill = Color.MAGENTA } else if(c2r1.fill == Color.WHITE and c1r1wit == not true ){ c2r1.fill = Color.MAGENTA } else if(c3r1.fill == Color.WHITE and c2r1wit == not true){ c3r1.fill = Color.MAGENTA } else if(c4r1.fill == Color.WHITE and c3r1wit == not true){ c4r1.fill = Color.MAGENTA } //de 2e regel roze maken else if(c1r2.fill == Color.WHITE and c4r1wit == not true){ c1r2.fill = Color.MAGENTA } else if(c2r2.fill == Color.WHITE and c1r2wit == not true){ c2r2.fill = Color.MAGENTA } else if(c3r2.fill == Color.WHITE and c2r2wit == not true){ c3r2.fill = Color.MAGENTA } else if(c4r2.fill == Color.WHITE and c3r2wit == not true){ c4r2.fill = Color.MAGENTA } //de 3e regel roze maken else if(c1r3.fill == Color.WHITE and c4r2wit == not true){ c1r3.fill = Color.MAGENTA } else if(c2r3.fill == Color.WHITE and c1r3wit == not true){ c2r3.fill = Color.MAGENTA } else if(c3r3.fill == Color.WHITE and c2r3wit == not true){ c3r3.fill = Color.MAGENTA } else if(c4r3.fill == Color.WHITE and c3r3wit == not true){ c4r3.fill = Color.MAGENTA } //de 4e regel roze maken else if(c1r4.fill == Color.WHITE and c4r3wit == not true){ c1r4.fill = Color.MAGENTA } else if(c2r4.fill == Color.WHITE and c1r4wit == not true){ c2r4.fill = Color.MAGENTA } else if(c3r4.fill == Color.WHITE and c2r4wit == not true){ c3r4.fill = Color.MAGENTA } else if(c4r4.fill == Color.WHITE and c3r4wit == not true){ c4r4.fill = Color.MAGENTA } //de 5e regel roze maken else if(c1r5.fill == Color.WHITE and c4r4wit == not true){ c1r5.fill = Color.MAGENTA } else if(c2r5.fill == Color.WHITE and c1r5wit == not true){ c2r5.fill = Color.MAGENTA } else if(c3r5.fill == Color.WHITE and c2r5wit == not true){ c3r5.fill = Color.MAGENTA } else if(c4r5.fill == Color.WHITE and c3r5wit == not true){ c4r5.fill = Color.MAGENTA } //de 6e regel roze maken else if(c1r6.fill == Color.WHITE and c4r5wit == not true){ c1r6.fill = Color.MAGENTA } else if(c2r6.fill == Color.WHITE and c1r6wit == not true){ c2r6.fill = Color.MAGENTA } else if(c3r6.fill == Color.WHITE and c2r6wit == not true){ c3r6.fill = Color.MAGENTA } else if(c4r6.fill == Color.WHITE and c3r6wit == not true){ c4r6.fill = Color.MAGENTA } //de code om cirkels in de zevende regel roze te maken else if(c1r7.fill == Color.WHITE and c4r6wit == not true){ c1r7.fill = Color.MAGENTA } else if(c2r7.fill == Color.WHITE and c1r7wit == not true){ c2r7.fill = Color.MAGENTA } else if(c3r7.fill == Color.WHITE and c2r7wit == not true){ c3r7.fill = Color.MAGENTA } else if(c4r7.fill == Color.WHITE and c3r7wit == not true){ c4r7.fill = Color.MAGENTA } //de code om cirkels in de 8e regel roze te maken else if(c1r8.fill == Color.WHITE and c4r7wit == not true){ c1r8.fill = Color.MAGENTA } else if(c2r8.fill == Color.WHITE and c1r8wit == not true){ c2r8.fill = Color.MAGENTA } else if(c3r8.fill == Color.WHITE and c2r8wit == not true){ c3r8.fill = Color.MAGENTA } else if(c4r8.fill == Color.WHITE and c3r8wit == not true){ c4r8.fill = Color.MAGENTA } //de code om cirkels in de 9e regel roze te maken else if(c1r9.fill == Color.WHITE and c4r7wit == not true){ c1r9.fill = Color.MAGENTA } else if(c2r9.fill == Color.WHITE and c1r8wit == not true){ c2r9.fill = Color.MAGENTA } else if(c3r9.fill == Color.WHITE and c2r8wit == not true){ c3r9.fill = Color.MAGENTA } else if(c4r9.fill == Color.WHITE and c3r8wit == not true){ c4r9.fill = Color.MAGENTA } //de code om in de laatste regel cirkels roze te maken else if(c1r10.fill == Color.WHITE and c4r9wit == not true){ c1r10.fill = Color.MAGENTA } else if(c2r10.fill == Color.WHITE and c1r10wit == not true){ c2r10.fill = Color.MAGENTA } else if(c3r10.fill == Color.WHITE and c2r10wit == not true){ c3r10.fill = Color.MAGENTA } else if(c4r10.fill == Color.WHITE and c3r10wit == not true){ c4r10.fill = Color.MAGENTA } } onMousePressed: function (e: MouseEvent): Void { magentacircle.stroke = Color.WHITE; } onMouseReleased: function (e: MouseEvent): Void { magentacircle.stroke = Color.BLACK; } } redcircle = Circle { centerX: 500, centerY: 295 radius: 22.5 strokeWidth: 5.0 stroke: Color.BLACK fill: Color.RED onMouseClicked: function (e: MouseEvent): Void { //de code om te bepalen of en welke cirkels rood moeten worden if(c1r1.fill == Color.WHITE){ c1r1.fill = Color.RED } else if(c2r1.fill == Color.WHITE and c1r1wit == not true ){ c2r1.fill = Color.RED } else if(c3r1.fill == Color.WHITE and c2r1wit == not true){ c3r1.fill = Color.RED } else if(c4r1.fill == Color.WHITE and c3r1wit == not true){ c4r1.fill = Color.RED } //de 2e regel rood maken else if(c1r2.fill == Color.WHITE and c4r1wit == not true){ c1r2.fill = Color.RED } else if(c2r2.fill == Color.WHITE and c1r2wit == not true){ c2r2.fill = Color.RED } else if(c3r2.fill == Color.WHITE and c2r2wit == not true){ c3r2.fill = Color.RED } else if(c4r2.fill == Color.WHITE and c3r2wit == not true){ c4r2.fill = Color.RED } //de 3e regel rood maken else if(c1r3.fill == Color.WHITE and c4r2wit == not true){ c1r3.fill = Color.RED } else if(c2r3.fill == Color.WHITE and c1r3wit == not true){ c2r3.fill = Color.RED } else if(c3r3.fill == Color.WHITE and c2r3wit == not true){ c3r3.fill = Color.RED } else if(c4r3.fill == Color.WHITE and c3r3wit == not true){ c4r3.fill = Color.RED } //de 4e regel rood maken else if(c1r4.fill == Color.WHITE and c4r3wit == not true){ c1r4.fill = Color.RED } else if(c2r4.fill == Color.WHITE and c1r4wit == not true){ c2r4.fill = Color.RED } else if(c3r4.fill == Color.WHITE and c2r4wit == not true){ c3r4.fill = Color.RED } else if(c4r4.fill == Color.WHITE and c3r4wit == not true){ c4r4.fill = Color.RED } //de 5e regel rood maken else if(c1r5.fill == Color.WHITE and c4r4wit == not true){ c1r5.fill = Color.RED } else if(c2r5.fill == Color.WHITE and c1r5wit == not true){ c2r5.fill = Color.RED } else if(c3r5.fill == Color.WHITE and c2r5wit == not true){ c3r5.fill = Color.RED } else if(c4r5.fill == Color.WHITE and c3r5wit == not true){ c4r5.fill = Color.RED } //de 6e regel rood maken else if(c1r6.fill == Color.WHITE and c4r5wit == not true){ c1r6.fill = Color.RED } else if(c2r6.fill == Color.WHITE and c1r6wit == not true){ c2r6.fill = Color.RED } else if(c3r6.fill == Color.WHITE and c2r6wit == not true){ c3r6.fill = Color.RED } else if(c4r6.fill == Color.WHITE and c3r6wit == not true){ c4r6.fill = Color.RED } //de code om cirkels in de zevende regel rood te maken else if(c1r7.fill == Color.WHITE and c4r6wit == not true){ c1r7.fill = Color.RED } else if(c2r7.fill == Color.WHITE and c1r7wit == not true){ c2r7.fill = Color.RED } else if(c3r7.fill == Color.WHITE and c2r7wit == not true){ c3r7.fill = Color.RED } else if(c4r7.fill == Color.WHITE and c3r7wit == not true){ c4r7.fill = Color.RED } //de code om cirkels in de 8e regel rood te maken else if(c1r8.fill == Color.WHITE and c4r7wit == not true){ c1r8.fill = Color.RED } else if(c2r8.fill == Color.WHITE and c1r8wit == not true){ c2r8.fill = Color.RED } else if(c3r8.fill == Color.WHITE and c2r8wit == not true){ c3r8.fill = Color.RED } else if(c4r8.fill == Color.WHITE and c3r8wit == not true){ c4r8.fill = Color.RED } //de code om cirkels in de 9e regel rood te maken else if(c1r9.fill == Color.WHITE and c4r7wit == not true){ c1r9.fill = Color.RED } else if(c2r9.fill == Color.WHITE and c1r8wit == not true){ c2r9.fill = Color.RED } else if(c3r9.fill == Color.WHITE and c2r8wit == not true){ c3r9.fill = Color.RED } else if(c4r9.fill == Color.WHITE and c3r8wit == not true){ c4r9.fill = Color.RED } //de code om in de laatste regel cirkels rood te maken else if(c1r10.fill == Color.WHITE and c4r9wit == not true){ c1r10.fill = Color.RED } else if(c2r10.fill == Color.WHITE and c1r10wit == not true){ c2r10.fill = Color.RED } else if(c3r10.fill == Color.WHITE and c2r10wit == not true){ c3r10.fill = Color.RED } else if(c4r10.fill == Color.WHITE and c3r10wit == not true){ c4r10.fill = Color.RED } } onMousePressed: function (e: MouseEvent): Void { redcircle.stroke = Color.WHITE; } onMouseReleased: function (e: MouseEvent): Void { redcircle.stroke = Color.BLACK; } } orangecircle = Circle { centerX: 500, centerY: 345 radius: 22.5 strokeWidth: 5.0 stroke: Color.BLACK fill: Color.ORANGE onMouseClicked: function (e: MouseEvent): Void { //de code om te bepalen of en welke cirkels oranje moeten worden if(c1r1.fill == Color.WHITE){ c1r1.fill = Color.ORANGE } else if(c2r1.fill == Color.WHITE and c1r1wit == not true ){ c2r1.fill = Color.ORANGE } else if(c3r1.fill == Color.WHITE and c2r1wit == not true){ c3r1.fill = Color.ORANGE } else if(c4r1.fill == Color.WHITE and c3r1wit == not true){ c4r1.fill = Color.ORANGE } //de 2e regel oranje maken else if(c1r2.fill == Color.WHITE and c4r1wit == not true){ c1r2.fill = Color.ORANGE } else if(c2r2.fill == Color.WHITE and c1r2wit == not true){ c2r2.fill = Color.ORANGE } else if(c3r2.fill == Color.WHITE and c2r2wit == not true){ c3r2.fill = Color.ORANGE } else if(c4r2.fill == Color.WHITE and c3r2wit == not true){ c4r2.fill = Color.ORANGE } //de 3e regel oranje maken else if(c1r3.fill == Color.WHITE and c4r2wit == not true){ c1r3.fill = Color.ORANGE } else if(c2r3.fill == Color.WHITE and c1r3wit == not true){ c2r3.fill = Color.ORANGE } else if(c3r3.fill == Color.WHITE and c2r3wit == not true){ c3r3.fill = Color.ORANGE } else if(c4r3.fill == Color.WHITE and c3r3wit == not true){ c4r3.fill = Color.ORANGE } //de 4e regel oranje maken else if(c1r4.fill == Color.WHITE and c4r3wit == not true){ c1r4.fill = Color.ORANGE } else if(c2r4.fill == Color.WHITE and c1r4wit == not true){ c2r4.fill = Color.ORANGE } else if(c3r4.fill == Color.WHITE and c2r4wit == not true){ c3r4.fill = Color.ORANGE } else if(c4r4.fill == Color.WHITE and c3r4wit == not true){ c4r4.fill = Color.ORANGE } //de 5e regel oranje maken else if(c1r5.fill == Color.WHITE and c4r4wit == not true){ c1r5.fill = Color.ORANGE } else if(c2r5.fill == Color.WHITE and c1r5wit == not true){ c2r5.fill = Color.ORANGE } else if(c3r5.fill == Color.WHITE and c2r5wit == not true){ c3r5.fill = Color.ORA

Share this post


Link to post
Share on other sites

Wow, huge code, why don't use array, for loop ... to shorten it Anyway, I had some looks if(c1r1.fill == Color.WHITE){c1r1.fill = Color.MAGENTA}else if(c2r1.fill == Color.WHITE and c1r1wit == false ){c2r1.fill = Color.MAGENTA/* Why not c2r1wit = false here */} if(c1r1.fill == Color.WHITE){c1r1wit = true} /* why not else{c1r1wit = false} here */ if(k1r1.fill == Color.WHITE){k1r1wit = true} /* why not else{k1r1wit = false} here */ :)

Edited by smiles

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×