-
Notifications
You must be signed in to change notification settings - Fork 0
/
maze.js
80 lines (69 loc) · 842 Bytes
/
maze.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Maze | IchigoLatte
// Copyright (c) 2019 Keiichi Shiga (BALLOON | FU-SEN)
// The MIT License (MIT) - https://mit.balloon.net.eu.org/#2019
// Maze
var x=0,y=0;
cls();
while(x<31)
{
lc(x,0);
log(chr(0x8f));
lc(x,22);
log(chr(0x8f));
x=x+1;
}
while(y<22)
{
lc(0,y);
log(chr(0x8f));
lc(30,y);
log(chr(0x8f));
y=y+1;
}
x=2;
while(x<29)
{
y=2;
while(y<21)
{
lc(x,y);
log(chr(0x8f));
var r=rnd(3);
var a=x-(r==0)+(r==1);
var b=y-(r==2)+(r==3);
lc(a,b);
log(chr(0x8f));
y=y+2;
}
x=x+2;
}
lc(29,21);
log(chr(242));
x=1;
y=1;
lc(x,y);
log(chr(249));
while((x<29)+(y<21))
{
var a=x;
var b=y;
while((a==x)*(b==y))
{
var k=inkey();
a=x-(k==28)+(k==29);
b=y-(k==30)+(k==31);
if(scr(a,b)==0x8f)
{
a=x;
b=y;
}
}
lc(x,y);
log(chr(32));
x=a;
y=b;
lc(x,y);
log(chr(249));
}
lc(0,23);