2017-11-17 23:06:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$discCount = 6;
|
|
|
|
//load the class
|
|
|
|
include("class.towers.php");
|
|
|
|
|
|
|
|
|
|
|
|
$tower = new Tower($discCount);
|
2017-11-21 10:09:10 +01:00
|
|
|
$steps = new Steps();
|
|
|
|
/*
|
2017-11-20 19:26:05 +01:00
|
|
|
echo "1".$tower."\n";
|
2017-11-21 10:09:10 +01:00
|
|
|
$move = Move::make(0,2);
|
2017-11-20 19:26:05 +01:00
|
|
|
$tower = $tower->add_move($move);
|
|
|
|
echo "2".$tower."\n";
|
2017-11-21 10:09:10 +01:00
|
|
|
print_r($tower->list_moves_availables());
|
|
|
|
*/
|
|
|
|
|
2017-11-17 23:06:00 +01:00
|
|
|
resolveHanoi($tower);
|
|
|
|
|
2017-11-21 10:09:10 +01:00
|
|
|
function resolveHanoi(Tower $tower, Steps $steps){
|
|
|
|
|
|
|
|
$steps->add_step($tower);
|
2017-11-17 23:06:00 +01:00
|
|
|
$availablesMoves = $tower->list_moves_availables();
|
|
|
|
|
2017-11-21 10:09:10 +01:00
|
|
|
//take only the moves who will generate a new unknowed Tower
|
|
|
|
$uniquesAvailableMoves = array();
|
|
|
|
foreach($availablesMoves as $move){
|
|
|
|
$newTower = $tower-> add_move($move);
|
|
|
|
//to do check if unique ************************************************
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-17 23:06:00 +01:00
|
|
|
//don't take moves that will generate an ever used tower configuration
|
2017-11-20 18:37:05 +01:00
|
|
|
$useful_moves = array();
|
2017-11-17 23:06:00 +01:00
|
|
|
foreach($availablesMoves as $move){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|