Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/jp/co/cis/other/Hanoi.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package jp.co.cis.other;

public class Hanoi {

public static void main(String[] args) {
Hanoi hanoi = new Hanoi();
hanoi.exec();
Expand All @@ -11,10 +11,10 @@ public static void main(String[] args) {
* ハノイの塔の移動させる円盤と塔を出力します
*/
public void exec() {

move(5, "START", "GOAL", "WORK");
}

/**
* 円盤を移動させます
* @param enban 移動させる円盤の枚数
Expand All @@ -23,21 +23,22 @@ public void exec() {
* @param work 作業用の棒
*/
private void move(int enban, String from, String to, String work) {

if(enban > 0) {
// 一番下でないなら続ける

// (1)一番下以外を作業用の棒に移動させる

move(enban-1 , from , work , to );

// (2)一番下をGOALに移動させる
System.out.println(enban + "番の円盤を" + from + "から" + to + "に移動させる");

// (3)(1)で移動させた円盤を棒を入れ替えて移動させる
move(enban-1 , work , to , from );

}



}



}
}
19 changes: 0 additions & 19 deletions src/jp/co/cis/sort/BubbleSort.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/jp/co/cis/sort/SelectionSort.java

This file was deleted.