Skip to content

Commit

Permalink
removed debug code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Furst committed Feb 5, 2019
1 parent 001952c commit dbe232a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/com/seefurst/towersofhanoi/boardobjects/Board.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class Board(numberOfDisksPerPole: Int) {


def moveDisks(diskIdx: Int, beginningPole: Int, auxiliaryPole: Int, destinationPole: Int, displayAfterMove: (Board) => Unit): Unit = {
System.out.println("we are moving disk: " + diskIdx +" from: "+ beginningPole +" to: " + destinationPole)
//System.out.println("we are moving disk: " + diskIdx +" from: "+ beginningPole +" to: " + destinationPole)
if (diskIdx == 0) {
System.out.println("reached base case..")
//System.out.println("reached base case..")
moveDisk(beginningPole, destinationPole)
displayAfterMove(this)
}
else {
System.out.println("not top disk, moving disk above it.")
///System.out.println("not top disk, moving disk above it.")
moveDisks(diskIdx-1, beginningPole, destinationPole, auxiliaryPole, displayAfterMove)
moveDisks(0, beginningPole, auxiliaryPole, destinationPole, displayAfterMove)
moveDisks(diskIdx-1, auxiliaryPole, beginningPole, destinationPole, displayAfterMove)
Expand All @@ -23,10 +23,10 @@ class Board(numberOfDisksPerPole: Int) {

@throws(classOf[IllegalStateException])
def moveDisk(source: Int, dest: Int) = {
System.out.println("calling move disk, beginning pole: " + source + " dest pole: " + dest)
//System.out.println("calling move disk, beginning pole: " + source + " dest pole: " + dest)
val sourcePole = poles(source) //index
val sourceDisk = sourcePole.removeDisk()
System.out.println("source disk: " + sourceDisk)
//System.out.println("source disk: " + sourceDisk)
if (sourceDisk == null ) throw new IllegalStateException;

val destPole = poles(dest) //index
Expand Down
4 changes: 2 additions & 2 deletions src/com/seefurst/towersofhanoi/boardobjects/Pole.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class Pole(numberOfDisks: Int) {
private val lineSeparator = System.lineSeparator();

def initDisks: Stack[Disk] = {
println("numberOfDisks: " + numberOfDisks);
// println("numberOfDisks: " + numberOfDisks);
val newDisks = new Stack[Disk]();
for (i <- numberOfDisks - 1 to 0 by -1
if (i >= 0)) { // the smallest disk should be the last in ... so
println("pushing disk " + i)
// println("pushing disk " + i)
newDisks.push(new Disk(i));
}
newDisks;
Expand Down

0 comments on commit dbe232a

Please sign in to comment.