From 3876e3a967be06076294b8014bb163b79fc55c59 Mon Sep 17 00:00:00 2001 From: theijligenberg Date: Thu, 26 Feb 2015 16:58:08 +0100 Subject: --- Week4/src/oo15loipe/AsciiArt.java | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Week4/src/oo15loipe/AsciiArt.java 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'); + } + } +} -- cgit v1.2.3