Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for java. There are 7(1-7) colors that you can use. For each guess you c

ID: 3805134 • Letter: T

Question

This is for java. There are 7(1-7) colors that you can use. For each guess you choose 4 colors. My question is how do you obtain a list of all the possible combinations? I know that the amount is (7)^4, but I can figure out the algorithm to obtain them.

Here's a visual

Another approach that never takes more than 6 attempts but takes more time for early Guesses is called MiniMax The idea is to create a List containing all possible Guesses (how many are there?). The first Guess in the List has all possible combinations of black and white buttons

Explanation / Answer

public static List pick(int num) { List colors = new ArrayList(); if (num < 2) return colors; float dx = 1.0f / (float) (num - 1); for (int i = 0; i = 0.0f && x < 0.2f) { x = x / 0.2f; r = 0.0f; g = x; b = 1.0f; } else if (x >= 0.2f && x < 0.4f) { x = (x - 0.2f) / 0.2f; r = 0.0f; g = 1.0f; b = 1.0f - x; } else if (x >= 0.4f && x < 0.6f) { x = (x - 0.4f) / 0.2f; r = x; g = 1.0f; b = 0.0f; } else if (x >= 0.6f && x < 0.8f) { x = (x - 0.6f) / 0.2f; r = 1.0f; g = 1.0f - x; b = 0.0f; } else if (x >= 0.8f && x
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote