diff options
author | Camil Staps | 2015-02-26 17:11:09 +0100 |
---|---|---|
committer | Camil Staps | 2015-02-26 17:11:09 +0100 |
commit | ffb54e3cf6241a6139bdb3c4c747193ee16fe740 (patch) | |
tree | 47ae220aaed9bfe7f082c98676f05d09d2cc3143 /Week4/src | |
parent | Merge branch 'master' into camil (diff) | |
parent | (no commit message) (diff) |
x
Diffstat (limited to 'Week4/src')
-rw-r--r-- | Week4/src/no.png | bin | 0 -> 3662 bytes | |||
-rw-r--r-- | Week4/src/nw.png | bin | 0 -> 3646 bytes | |||
-rw-r--r-- | Week4/src/nz.png | bin | 0 -> 199 bytes | |||
-rw-r--r-- | Week4/src/nzow.png | bin | 0 -> 214 bytes | |||
-rw-r--r-- | Week4/src/oo15loipe/AsciiArt.java | 13 | ||||
-rw-r--r-- | Week4/src/oo15loipe/InfoLoipe.java | 10 | ||||
-rw-r--r-- | Week4/src/oo15loipe/LoipePlaatje.java | 6 | ||||
-rw-r--r-- | Week4/src/ow.png | bin | 0 -> 3273 bytes | |||
-rw-r--r-- | Week4/src/zo.png | bin | 0 -> 3662 bytes | |||
-rw-r--r-- | Week4/src/zw.png | bin | 0 -> 3641 bytes |
10 files changed, 18 insertions, 11 deletions
diff --git a/Week4/src/no.png b/Week4/src/no.png Binary files differnew file mode 100644 index 0000000..daaec27 --- /dev/null +++ b/Week4/src/no.png diff --git a/Week4/src/nw.png b/Week4/src/nw.png Binary files differnew file mode 100644 index 0000000..2699df3 --- /dev/null +++ b/Week4/src/nw.png diff --git a/Week4/src/nz.png b/Week4/src/nz.png Binary files differnew file mode 100644 index 0000000..c4eeb9c --- /dev/null +++ b/Week4/src/nz.png diff --git a/Week4/src/nzow.png b/Week4/src/nzow.png Binary files differnew file mode 100644 index 0000000..96ab874 --- /dev/null +++ b/Week4/src/nzow.png diff --git a/Week4/src/oo15loipe/AsciiArt.java b/Week4/src/oo15loipe/AsciiArt.java index cc4111b..3ee3367 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.getHeight(); 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 764e2f3..1796418 100644 --- a/Week4/src/oo15loipe/InfoLoipe.java +++ b/Week4/src/oo15loipe/InfoLoipe.java @@ -10,10 +10,10 @@ package oo15loipe; * @author cstaps */ public interface InfoLoipe { - public int getWidth(); // grootte in oost−west ri c h ti n g - public int getHeight(); // 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 Punt start(); // Het startpunt op de kaart - public Punt stap(); // het volgende punt op de route + public int getWidth( ) ; // grootte in oostwest r i cht ing + public int getHeight( ) ; // grootte in noordzuid 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 } diff --git a/Week4/src/oo15loipe/LoipePlaatje.java b/Week4/src/oo15loipe/LoipePlaatje.java index 3166309..db70d28 100644 --- a/Week4/src/oo15loipe/LoipePlaatje.java +++ b/Week4/src/oo15loipe/LoipePlaatje.java @@ -37,13 +37,13 @@ public class LoipePlaatje extends JFrame implements TekenLoipe /** * previous position for walking the loipe */ - private Point previousPos = null; + private Punt previousPos = null; /** * Constructor. Fill all icons. */ public LoipePlaatje(InfoLoipe s) { - super("Kaart"); + super("Loipe"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); nz = plaatje("nz"); ow = plaatje("ow"); @@ -177,7 +177,7 @@ public class LoipePlaatje extends JFrame implements TekenLoipe } @Override - public void setPosition(Point p) { + public void setPosition(Punt p) { Graphics g = panel.getGraphics(); if (previousPos != null) { g.setColor(SNOW); diff --git a/Week4/src/ow.png b/Week4/src/ow.png Binary files differnew file mode 100644 index 0000000..8d35019 --- /dev/null +++ b/Week4/src/ow.png diff --git a/Week4/src/zo.png b/Week4/src/zo.png Binary files differnew file mode 100644 index 0000000..1b578c0 --- /dev/null +++ b/Week4/src/zo.png diff --git a/Week4/src/zw.png b/Week4/src/zw.png Binary files differnew file mode 100644 index 0000000..702e57d --- /dev/null +++ b/Week4/src/zw.png |