-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEDGE_2011-09-21_11;41;59.java
80 lines (80 loc) · 1.33 KB
/
EDGE_2011-09-21_11;41;59.java
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
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str;
while((str = in.readLine()) != null && str.length() != 0)
{
int x=31;
int y=42;
char direction='r';
System.out.println("300 420 moveto");
System.out.println("310 420 lineto");
for (int i = 0; i < str.length(); i++)
{
if(str.charAt(i)=='V')
{
switch (direction) {
case 'u':
{
direction='l';
x--;
break;
}
case 'd':
{
direction='r';
x++;
break;
}
case 'l':
{
direction='d';
y--;
break;
}
case 'r':
{
direction='u';
y++;
break;
}
}
}
else
{
switch (direction) {
case 'u':
{
direction='r';
x++;
break;
}
case 'd':
{
direction='l';
x--;
break;
}
case 'l':
{
direction='u';
y++;
break;
}
case 'r':
{
direction='d';
y--;
break;
}
}
}
System.out.println((x*10)+" "+(y*10)+" lineto");
}
System.out.println("stroke");
System.out.println("showpage");
}
}
}