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_pen c * 3.5 + 71.5 r * 11.5 + 10.4 + j * 3.5
move c * 3.5 + 71.5 r * 11.5 + 10.4 + j * 3.5
if black > 0
if black > 0
set_color 000
color 000
draw_circle 1.4
circle 1.4
black -= 1
black -= 1
elif white > 0
elif white > 0
set_color 999
color 999
draw_circle 1.4
circle 1.4
white -= 1
white -= 1
else
else
set_color 310
color 310
draw_circle 0.7
circle 0.7
.
.
.
.
Line 1,055: Line 1,055:
.
.
func show_code . .
func show_code . .
set_color 531
color 531
move_pen 22 0
move 22 0
draw_rect 46 8
rect 46 8
for i range 4
for i range 4
move_pen i * 8 + 28 3
move i * 8 + 28 3
set_color col[code[i]]
color col[code[i]]
draw_circle 2
circle 2
.
.
.
.
func draw_guess . .
func draw_guess . .
for c range 4
for c range 4
move_pen c * 12 + 20 row * 11.5 + 12
move c * 12 + 20 row * 11.5 + 12
set_color col[guess[c]]
color col[guess[c]]
draw_circle 3.8
circle 3.8
.
.
.
.
func next_row . .
func next_row . .
set_color 420
color 420
set_linewidth 11
linewidth 11
move_pen 17 row * 11.5 + 12
move 17 row * 11.5 + 12
draw_line 60 row * 11.5 + 12
line 60 row * 11.5 + 12
call draw_guess
call draw_guess
move_pen 73.5 row * 11.5 + 12
move 73.5 row * 11.5 + 12
set_color 310
color 310
draw_circle 5.0
circle 5.0
set_color 753
color 753
move_pen 71.5 row * 11.5 + 8.5
move 71.5 row * 11.5 + 8.5
set_textsize 7
textsize 7
draw_text "✓"
text "✓"
.
.
func rate . .
func rate . .
move_pen 73.5 row * 11.5 + 12
move 73.5 row * 11.5 + 12
set_color 531
color 531
draw_circle 5.2
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
set_color 531
color 531
set_linewidth 12
linewidth 12
move_pen 17 row * 11.5 + 12
move 17 row * 11.5 + 12
draw_line 60 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
set_timer 1
timer 2
else
else
call next_row
call next_row
Line 1,132: Line 1,132:
code[i] = random 6
code[i] = random 6
.
.
set_color 531
color 531
move_pen 10 10
move 10 10
draw_rect 70 80
rect 70 80
set_linewidth 10
linewidth 10
move_pen 5 5
move 5 5
draw_line 5 95
line 5 95
draw_line 85 95
line 85 95
draw_line 85 5
line 85 5
draw_line 5 5
line 5 5
set_color 310
color 310
set_linewidth 7
linewidth 7
move_pen 28 3.5
move 28 3.5
draw_line 58 3.5
line 58 3.5
move_pen 30 1
move 30 1.5
set_color 864
color 864
set_textsize 4.5
textsize 4
draw_text "Mastermind"
text "Mastermind"
set_color 310
color 310
set_linewidth 0.5
linewidth 0.5
move_pen 10 10
move 10 10
draw_line 10 96
line 10 96
move_pen 67 10
move 67 10
draw_line 67 96
line 67 96
move_pen 80 10
move 80 10
draw_line 80 96
line 80 96
for r range 8
for r range 8
for c range 4
for c range 4
move_pen c * 12 + 20 r * 11.5 + 12
move c * 12 + 20 r * 11.5 + 12
draw_circle 2
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