viewofn=Inputs.number({value:4,label:"Enter the number:"})
steps=[]
{
hanoi(n,"One","Three","Two")
returnsteps
}
functionhanoi(n,from,to,spare){
steps.length=0;
move(n,from,to,spare)
}
functionmove(n,from,to,spare){
if(n>0){
move(n-1,from,spare,to,steps);
steps.push("Move "+n+" from "+from+" to "+to)
move(n-1,spare,to,from,steps);
}
}
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.