Skip to content
Snippets Groups Projects
Commit f081317f authored by sbalev's avatar sbalev
Browse files

Added text display

parent fb919841
No related merge requests found
......@@ -13,18 +13,22 @@ int code;
int t;
void setup() {
size(310, 560);
size(310, 570);
background(191);
code = int(random(M));
tk.displayCode(code, GAP, GAP, PEG_SIZE, false);
line(GAP, 2 * GAP + PEG_SIZE, GAP + 4 * PEG_SIZE, 2 * GAP + PEG_SIZE);
println(tk.codeToString(code));
println("----");
t = 0;
}
void draw() {
t++;
int guess = int(random(M));
int y = GAP + (GAP + PEG_SIZE) * t;
int y = 2 * GAP + (GAP + PEG_SIZE) * t;
tk.displayCode(guess, GAP, y, PEG_SIZE, false);
print(tk.codeToString(guess));
int f = tk.feedback(code, guess);
displayFeedback(f, 2 * GAP + N * PEG_SIZE, y + PEG_SIZE / 4);
if (f == 0 || t == 10) noLoop();
......@@ -39,4 +43,5 @@ void displayFeedback(int f, int x, int y) {
rect(x, y, PEG_SIZE / 2, PEG_SIZE / 2);
x += PEG_SIZE / 2 + GAP;
}
println(" ", bw[0], bw[1]);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment