Selasa, 21 Oktober 2014

Pseudocode tower of hanoi auto solution


Begin
define tower A as source tower, tower C as destination tower and tower B as temporary tower, with 10 ring.

Identification condition of tower
//if tower B empty or Ring in destination > Ring 1, move Ring 1 to
tower B
begin
start identification tower
//Condition 1
if tower not empty then identification ring in tower.if ring in destination< ring source
Break;
//condition 2
if tower  empty or Ring in destination > ring from Source, move Ring 2 from source to destination
Begin
start identification
if condition is condition 1
break
then start condition 2
//if all ring have been moved  to ring C
stop program
end

Tidak ada komentar:

Posting Komentar