diff options
author | theijligenberg | 2015-02-26 16:58:08 +0100 |
---|---|---|
committer | theijligenberg | 2015-02-26 16:58:08 +0100 |
commit | 3876e3a967be06076294b8014bb163b79fc55c59 (patch) | |
tree | c0f7a27f6d5a379bbeb8a50a04a272337d43765d /Week4/src/oo15loipe | |
parent | x (diff) |
Diffstat (limited to 'Week4/src/oo15loipe')
-rw-r--r-- | Week4/src/oo15loipe/AsciiArt.java | 44 |
1 files changed, 44 insertions, 0 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');
+ }
+ }
+}
|