//Get input from the user public Player2Window() { Glide.FitToScreen = true; winPlayer2 = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Player2)); currentGroup = 1; winPlayer2.Render(); startNewRow(); }
//Get input from the user public Player2Window() { Glide.FitToScreen = true; winPlayer2 = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Player2)); currentGroup = 1; winPlayer2.Render(); startNewRow(); }
//Constructor for 2 Players Game public MasterMind(int[] newSolution) { Glide.FitToScreen = true; masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind)); currentGroup = 1; //Replace the solution with the input given by the user from 2 Player solution = newSolution; //Add color codes listColors[0] = 255; listColors[1] = 32768; listColors[2] = 16777215; listColors[3] = 16711680; listColors[4] = 65535; listColors[5] = 42495; masterMind.Render(); }
//Constructor for 2 Players Game public MasterMind(int[] newSolution) { Glide.FitToScreen = true; masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind)); currentGroup = 1; //Replace the solution with the input given by the user from 2 Player solution = newSolution; //Add color codes listColors[0] = 255; listColors[1] = 32768; listColors[2] = 16777215; listColors[3] = 16711680; listColors[4] = 65535; listColors[5] = 42495; masterMind.Render(); }
//Constructor for 1 Player Game public MasterMind() { Glide.FitToScreen = true; masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind)); currentGroup = 1; // Generate Random Sequence for colors for (int i = 0; i < solution.Length; i++) { solution[i] = new Random().Next(6); Debug.Print("\n Solution :: " + solution[i]); } //Add color codes listColors[0] = 255; listColors[1] = 32768; listColors[2] = 16777215; listColors[3] = 16711680; listColors[4] = 65535; listColors[5] = 42495; masterMind.Render(); }
//Constructor for 1 Player Game public MasterMind() { Glide.FitToScreen = true; masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind)); currentGroup = 1; // Generate Random Sequence for colors for (int i = 0; i < solution.Length; i++) { solution[i] = new Random().Next(6); Debug.Print("\n Solution :: " + solution[i]); } //Add color codes listColors[0] = 255; listColors[1] = 32768; listColors[2] = 16777215; listColors[3] = 16711680; listColors[4] = 65535; listColors[5] = 42495; masterMind.Render(); }
//Submit the result for the row public bool submitResult() { int pinLocation = 0; ++round; fullyCorrect = 0; halfCorrect = 0; int[] places = new int[4] { -1, -1, -1, -1 }; int[] places2 = new int[4] { -1, -1, -1, -1 }; //Current selection of the color codes int[] currentSelection = new int[4]; currentSelection[0] = (int)r1.Color; currentSelection[1] = (int)r2.Color; currentSelection[2] = (int)r3.Color; currentSelection[3] = (int)r4.Color; ////Check At exact same position for (int i = 0; i < solution.Length; i++) { if (currentSelection[i] == listColors[solution[i]]) { fullyCorrect++; places[i] = 1; places2[i] = 1; //TheScore.AddBlackPeg(CurrentRow, pinLocation); pinLocation++; } } for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { // make sure the positions aren't the same and the pegs in the different positions // both in the solution and the player row haven't already been determined if ((i != j) && (places[i] != 1) && (places2[j] != 1)) { // if the GuessedRow color matches the Grid Color at a different position // We have a white peg if (currentSelection[i] == listColors[solution[j]]) { //TheScore.AddWhitePeg(CurrentRow, pinLocation); pinLocation++; places[i] = 1; places2[j] = 1; halfCorrect++; break; } } } } bool result = populateVisualResult(fullyCorrect, halfCorrect); yPostition += 20; masterMind.Render(); masterMind.Invalidate(); resetOutline(); //change later if (currentGroup < 10) { currentGroup++; } else { currentGroup = 0; } if (!result) { startNewRow(); } return(result); }