From 6593c06eb9adb341968d6895308155b00b21c0fc Mon Sep 17 00:00:00 2001 From: theijligenberg Date: Thu, 26 Feb 2015 17:06:31 +0100 Subject: --- Week4/src/oo15loipe/AsciiArt.java | 13 ++++++++++--- Week4/src/oo15loipe/InfoLoipe.java | 8 +++++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'Week4') 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 } -- cgit v1.2.3