blob: cc4111b470b577ac8f2edfd0ff904571583f208f (
plain) (
blame)
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
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package oo15loipe;
/**
* a class that draws the loipe as ascii-art.
* @author theijligenberg
*/
public class AsciiArt implements TekenLoipe{
private InfoLoipe L;
public AsciiArt(InfoLoipe s){
this.L = s;
}
@Override
public void setPosition(Punt p){
}
/**
* draws the loipe by checking each fragment at (i,j) for its direction
*/
@Override
public void teken(){
for(int i = 0; i < L.getX(); i++){
for(int j = 0; j < L.getY(); j++){
Fragment f = L.getFragment(i,j);
switch (f){
case KR: System.out.print('+'); break;
case NZ: System.out.print('|'); break;
case OW: System.out.print('-'); break;
case NO: System.out.print('`'); break;
case NW: System.out.print(','); break;
case ZO: System.out.print('|'); break;
case ZW: System.out.print('\''); break;
default: System.out.print(' ');
}
}
System.out.print('\n');
}
}
}
|