public final class TowersOfHanoi { // Move disc n and everything below it to the left or right public static void moves (final int n, final boolean left) { if (n > 0) { moves (n-1, !left); System.out.printf ("move disc %d %s%n", n, left?"left":"right"); moves (n-1, !left); } } public static void main (final String[] args) { final int n = Integer.parseInt (args[0]); moves (n, true); } }