aboutsummaryrefslogtreecommitdiff
path: root/Week4
diff options
context:
space:
mode:
authortheijligenberg2015-02-26 17:06:31 +0100
committertheijligenberg2015-02-26 17:06:31 +0100
commit6593c06eb9adb341968d6895308155b00b21c0fc (patch)
treec0598f8f07a16c99a80e3dd6e64e8b19abe49103 /Week4
parent(no commit message) (diff)
Diffstat (limited to 'Week4')
-rw-r--r--Week4/src/oo15loipe/AsciiArt.java13
-rw-r--r--Week4/src/oo15loipe/InfoLoipe.java8
2 files changed, 15 insertions, 6 deletions
diff --git a/Week4/src/oo15loipe/AsciiArt.java b/Week4/src/oo15loipe/AsciiArt.java
index cc4111b..07c73c1 100644
--- a/Week4/src/oo15loipe/AsciiArt.java
+++ b/Week4/src/oo15loipe/AsciiArt.java
@@ -11,21 +11,28 @@ package oo15loipe;
*/
public class AsciiArt implements TekenLoipe{
private InfoLoipe L;
+ private Punt man;
+
public AsciiArt(InfoLoipe s){
this.L = s;
+ this.man = new Punt(null);
}
@Override
public void setPosition(Punt p){
-
+ this.man = 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++){
+ for(int i = 0; i < L.getWidth(); i++){
+ for(int j = 0; j < L.getHeigth(); j++){
+ if(i == man.getX() && j == man.getY()){
+ System.out.print('*');
+ break;
+ }
Fragment f = L.getFragment(i,j);
switch (f){
case KR: System.out.print('+'); break;
diff --git a/Week4/src/oo15loipe/InfoLoipe.java b/Week4/src/oo15loipe/InfoLoipe.java
index 931a267..9ff318d 100644
--- a/Week4/src/oo15loipe/InfoLoipe.java
+++ b/Week4/src/oo15loipe/InfoLoipe.java
@@ -10,8 +10,10 @@ package oo15loipe;
* @author cstaps
*/
public interface InfoLoipe {
- public int getX() ; // grootte in oost−west ri c h ti n g
- public int getY() ; // grootte in noord−zuid ri c h ti n g
- public Fragment getFragment(int x, int y) ; // fragment van de l oi p e op p o si ti e (x , y)
+ public int getWidth( ) ; // grootte in oost􀀀west r i cht ing
+ public int getHeigth( ) ; // grootte in noord􀀀zuid r i cht ing
+ public Fragment getFragment( int x, int y) ; // fragment van de loipe op po s i t i e (x , y)
+ public Punt start( ) ; // Het startpunt op de kaart
+ public Punt stap( ) ; // het volgende punt op de route
}