Mastermind: Difference between revisions
m
→{{header|EasyLang}}
(→{{header|Python}}: Edited Python example to match rules as discussed under the section about the Julia implementation) |
|||
Line 244:
for j range 2
for c range 2
move c * 3 +
if black > 0
color 000
Line 270:
.
.
func
for i range 4▼
guess[i] = -1▼
.▼
for c range 4
move c *
color
circle
color 420▼
circle 1.7▼
.
.
func next_row . .
call draw_guess
color 642▼
.
func rate . .
test[] = code[]▼
g[] = guess[]
for i range 4
if
black += 1
.
.
for i range 4
for j range 4
if
white += 1
.
.
.
▲ move 64 row * 11 + 11
▲ color 642
call draw_rate row black white
row -= 1
Line 321 ⟶ 325:
.
color 642
move 15
rect 70
line 10 95
line 90 95
line 90 5
line 10 5
color 420
linewidth 7
▲ move 27 0
color 864
textsize 4.5▼
text "Mastermind"
color 420
linewidth 0.5
▲ move 25 10
line 72 96
move 85 10
line 85 96
for r range 8
for c range 4
move c *
circle 2
.
call draw_rate r 0 0
▲ .
▲ for i range 4
.
call next_row
.
func do_move . .
c = trunc ((mouse_x -
guess[c] = (guess[c] + 1) mod 6
call draw_guess
▲ circle 3.2
▲ move 64 row * 11 + 11
▲ move 64.2 row * 11 + 11.2
▲ color 642
▲ text "OK"
.
on mouse_down
if row = -1
call new
elif mouse_y > row * 11.5 +
if mouse_x >
call do_move
elif mouse_x >
▲ call rate
.
.
.
▲textsize 5
▲linewidth 0.8
call new</lang>
|