/*
 * Created on 20.12.2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package de.unidue.is.prog.woche10;

/**
 * @author kriewel
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Weihnachtsbaum {

	/**
	 * 
	 */
	public Weihnachtsbaum(int height) {
		
		for (int i = 0 ; i < height ; i++) {
			int j = i - (i/4)*2;
			if (height - i < 2)	j+=2;
			if ((i+2)%4 == 0) {
				luft(height - (j+1)); 
				System.out.print("|"); nadeln(j*2-1); System.out.print("|");
			} else  {
				luft(height - j); nadeln(j*2-1);
			}
			System.out.println();
		}
		stamm(height-2);
	}

	static void luft(int i)  {
		for (int k=0; k<i; k++) 
			System.out.print(" ");
	}

	static void nadeln(int i)  {
		for (int k=0; k<i; k++) 
			if (k>0 && k<i-1)
				if (Math.random()<0.9)
					System.out.print("*");
				else
					System.out.print("o");
					
			else
				System.out.print("*");
	}
	
	static void stamm(int i) {
		luft(i); System.out.println("###");
		luft(i); System.out.println("###");
	}
	
	public static void main(String[] args) {
		Weihnachtsbaum wb = new Weihnachtsbaum(21);
	}
}
