Jump to content

Mastermind: Difference between revisions

m
Line 234:
[https://easylang.online/apps/mastermind.html Run it]
 
<lang>col[] = [ 922902 990 171 229 950960 808 ]
len code[] 4
len guess[] 4
Line 244:
for j range 2
for c range 2
move c * 3.5 + 76.5 r * 11.5 + 10.54 + j * 3.5
if black > 0
color 000
circle 1.24
black -= 1
elif white > 0
color 999
circle 1.24
white -= 1
else
color 420310
circle 0.7
.
Line 261:
.
func show_code . .
color 642531
move 27 0
rect 46 8
Line 278:
.
func next_row . .
call draw_guess
move 78 row * 11.5 + 12
color 420
linewidth 11
circle 4.5
move 7522 row * 11.5 + 9.912
line 65 row * 11.5 + 12
color 642
call draw_guess
move 78.5 row * 11.5 + 12
color 642310
circle 4.5.0
move 75.7 row * 11.5 + 9.8
color 753
text "OK"
.
func rate . .
move 78.5 row * 11.5 + 12
color 642531
circle 45.82
c[] = code[]
g[] = guess[]
Line 309 ⟶ 313:
.
call draw_rate row black white
color 531
linewidth 12
move 22 row * 11.5 + 12
line 65 row * 11.5 + 12
call draw_guess
row -= 1
if black = 4
Line 315 ⟶ 324:
if row = -1
call show_code
timer 1
else
call next_row
.
.
on timer
row = -2
.
func new . .
Line 324 ⟶ 337:
code[i] = random 6
.
color 642531
move 15 10
rect 70 80
Line 333 ⟶ 346:
line 90 5
line 10 5
color 420310
linewidth 7
move 33 3.5
Line 341 ⟶ 354:
textsize 4.5
text "Mastermind"
color 420310
linewidth 0.5
move 15 10
Line 362 ⟶ 375:
.
func do_move . .
c = truncfloor ((mouse_x - 20) / 12)
guess[c] = (guess[c] + 1) mod 6
call draw_guess
.
on mouse_down
if row = -12
call new
elif mouse_y > row * 11.5 + 7 and mouse_y < row * 11.5 + 17
2,056

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.