diff options
author | Camil Staps | 2015-02-26 17:00:22 +0100 |
---|---|---|
committer | Camil Staps | 2015-02-26 17:00:22 +0100 |
commit | 24b46a2cc4c820328e8a3b10f3f745a32aae68a3 (patch) | |
tree | 900538762c48f02ff00261fab0a98a13bca986e9 /Week4 | |
parent | Added base framework week4 (diff) | |
parent | (no commit message) (diff) |
Merge branch 'master' into camil
Diffstat (limited to 'Week4')
-rw-r--r-- | Week4/src/oo15loipe/AsciiArt.java | 44 | ||||
-rw-r--r-- | Week4/src/oo15loipe/TekenLoipe.java | 4 |
2 files changed, 46 insertions, 2 deletions
diff --git a/Week4/src/oo15loipe/AsciiArt.java b/Week4/src/oo15loipe/AsciiArt.java new file mode 100644 index 0000000..cc4111b --- /dev/null +++ b/Week4/src/oo15loipe/AsciiArt.java @@ -0,0 +1,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');
+ }
+ }
+}
diff --git a/Week4/src/oo15loipe/TekenLoipe.java b/Week4/src/oo15loipe/TekenLoipe.java index 05d58b6..de9e742 100644 --- a/Week4/src/oo15loipe/TekenLoipe.java +++ b/Week4/src/oo15loipe/TekenLoipe.java @@ -10,6 +10,6 @@ package oo15loipe; * @author cstaps */ public interface TekenLoipe { - public void setLoipe(InfoLoipe s) ; // gee f nieuwe l oi p e aan teken ob ject - public void teken() ; // teken de gegeven l oi p e + public void teken() ; // teken de gegeven loipe + public void setPosition(Punt p) ; // teken de spor ter op de gegeven po s i t i e } |