+ 5
Do you know some interesting recursion algorithms?
I mean something more complicated than factorial or tower of hanoi? It will be nice if it has graphical results.
8 odpowiedzi
+ 11
I have it.
Welcome! :)
+ 9
You can see my codes if you are interesting with algorithms.
+ 6
Hey, nikunj arora. In your program computer move taking a little time when start. Due to recursion of minimax function, it slow down your program. And decrease its time on next move. Moreover you have use
setTimeout(function(){
computerMove()
},100)
;
It makes your program non blocking. And before completing computerMove function it execute code that takes less time in a normal sequence. If you use
setTimeout(computerMove(),100)
;
At first your computerMove run and save that time, but in both cases your computerMove function slow and than hide and show function below to this.
+ 4
The delay is because of recursion. But When you choose player, computerMove function execute internally and when you have done with your step, it execute, and it seems that it is fast when Player take first step. But it is slow in both of cases. But you have coded a great code.
+ 3
well I don't know in graphical recursion. But recursion is better for inorder,postorder,preorder tree traversal than writing a big code.
+ 3
The minimax algorithm which is used to create an unbeatable AI for simple zero sum games, like Tic-tac-toe relies heavily on recursion.
I have the code on my account. You can check it out.
+ 2
thanks aditya... I added the timeout to create a realistic effect for the computer.
it's working immediately when I remove it. but when the computer goes first, there is an unexpected long delay only on the first turn. the rest of the turns are working fine.
+ 2
thanks for the info.. I'll try to improve it