Mastermind: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
|||
Line 1,038: | Line 1,038: | ||
for j range 2 |
for j range 2 |
||
for c range 2 |
for c range 2 |
||
move c * 3.5 + 71.5 r * 11.5 + 10.4 + j * 3.5 |
|||
if black > 0 |
if black > 0 |
||
color 000 |
|||
circle 1.4 |
|||
black -= 1 |
black -= 1 |
||
elif white > 0 |
elif white > 0 |
||
color 999 |
|||
circle 1.4 |
|||
white -= 1 |
white -= 1 |
||
else |
else |
||
color 310 |
|||
circle 0.7 |
|||
. |
. |
||
. |
. |
||
Line 1,055: | Line 1,055: | ||
. |
. |
||
func show_code . . |
func show_code . . |
||
color 531 |
|||
move 22 0 |
|||
rect 46 8 |
|||
for i range 4 |
for i range 4 |
||
move i * 8 + 28 3 |
|||
color col[code[i]] |
|||
circle 2 |
|||
. |
. |
||
. |
. |
||
func draw_guess . . |
func draw_guess . . |
||
for c range 4 |
for c range 4 |
||
move c * 12 + 20 row * 11.5 + 12 |
|||
color col[guess[c]] |
|||
circle 3.8 |
|||
. |
. |
||
. |
. |
||
func next_row . . |
func next_row . . |
||
color 420 |
|||
linewidth 11 |
|||
move 17 row * 11.5 + 12 |
|||
line 60 row * 11.5 + 12 |
|||
call draw_guess |
call draw_guess |
||
move 73.5 row * 11.5 + 12 |
|||
color 310 |
|||
circle 5.0 |
|||
color 753 |
|||
move 71.5 row * 11.5 + 8.5 |
|||
textsize 7 |
|||
text "✓" |
|||
. |
. |
||
func rate . . |
func rate . . |
||
move 73.5 row * 11.5 + 12 |
|||
color 531 |
|||
circle 5.2 |
|||
c[] = code[] |
c[] = code[] |
||
g[] = guess[] |
g[] = guess[] |
||
Line 1,108: | Line 1,108: | ||
. |
. |
||
call draw_rate row black white |
call draw_rate row black white |
||
color 531 |
|||
linewidth 12 |
|||
move 17 row * 11.5 + 12 |
|||
line 60 row * 11.5 + 12 |
|||
call draw_guess |
call draw_guess |
||
row -= 1 |
row -= 1 |
||
Line 1,119: | Line 1,119: | ||
if row = -1 |
if row = -1 |
||
call show_code |
call show_code |
||
timer 2 |
|||
else |
else |
||
call next_row |
call next_row |
||
Line 1,132: | Line 1,132: | ||
code[i] = random 6 |
code[i] = random 6 |
||
. |
. |
||
color 531 |
|||
move 10 10 |
|||
rect 70 80 |
|||
linewidth 10 |
|||
move 5 5 |
|||
line 5 95 |
|||
line 85 95 |
|||
line 85 5 |
|||
line 5 5 |
|||
color 310 |
|||
linewidth 7 |
|||
move 28 3.5 |
|||
line 58 3.5 |
|||
move 30 1.5 |
|||
color 864 |
|||
textsize 4 |
|||
text "Mastermind" |
|||
color 310 |
|||
linewidth 0.5 |
|||
move 10 10 |
|||
line 10 96 |
|||
move 67 10 |
|||
line 67 96 |
|||
move 80 10 |
|||
line 80 96 |
|||
for r range 8 |
for r range 8 |
||
for c range 4 |
for c range 4 |
||
move c * 12 + 20 r * 11.5 + 12 |
|||
circle 2 |
|||
. |
. |
||
call draw_rate r 0 0 |
call draw_rate r 0 0 |
||
Line 1,178: | Line 1,178: | ||
if row = -2 |
if row = -2 |
||
call new |
call new |
||
elif mouse_y > row * 11.5 + 7 and mouse_y < row * 11.5 + 17 |
elif mouse_y > row * 11.5 + 7 and mouse_y < row * 11.5 + 17 and row >= 0 |
||
if mouse_x > 15 and mouse_x < 61 |
if mouse_x > 15 and mouse_x < 61 |
||
call do_move |
call do_move |