public static void gameloop() throws Exception {
		final byte[] directionPriority = { Engine.D_DOWN, Engine.D_LEFT, Engine.D_RIGHT, Engine.D_UP };

		System.out.println("started gameloop");

		while (true) {
			System.out.println("turn started");
			for (byte dir = 0; dir < 4; dir++) {
				System.out.println("attempting... " + directionPriority[dir]);

				final int status = engine.swipe(directionPriority[dir]);

				if (status == 1) {
					System.out.println("moved " + directionPriority[dir]);

					try {
						Thread.currentThread();
						Thread.sleep(7);//sleep for 80 ms

					} catch (final InterruptedException e) {
						e.printStackTrace();
					}
					break;

				} else if (status == 0) {
					System.out.println("invalid... ");
					continue;

				} else {
					System.out.println("you lose");
					throw new Exception();
				}
			}
		}
	}