Login   Register  
PHP Classes
elePHPant
Icontem

how to restart the game after finishing it without page refresh

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Tic-Tac-Toe  >  All threads  >  how to restart the game after finishing it without page refresh  >  (Un) Subscribe thread alerts  
Subject:how to restart the game after finishing it without page refresh
Summary:need to restart the game
Messages:7
Author:Ankit Kumar Chauhan
Date:2012-05-08 07:31:20
Update:2012-05-09 07:39:31
 

  1. how to restart the game after finishing it without page refresh   Reply   Report abuse  
Picture of Ankit Kumar Chauhan
Ankit Kumar Chauhan
2012-05-08 07:31:20
Hi

I've used the code just for fun, but i am not figuring out how to restart the game without page refresh. I want it to be happen just after finish the game in javascript confirmation box.

thanx.

  2. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Amin Saeidi
Amin Saeidi
2012-05-08 07:53:24 - In reply to message 1 from Ankit Kumar Chauhan
Hi,
It is not implemented and I believe it would be trivial.

  3. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Ankit Kumar Chauhan
Ankit Kumar Chauhan
2012-05-08 07:56:05 - In reply to message 2 from Amin Saeidi
but there should be an option in my opinion. If it is possible, can you please help me. how to do it?

  4. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Amin Saeidi
Amin Saeidi
2012-05-08 14:34:27 - In reply to message 3 from Ankit Kumar Chauhan
You just need to reinitialize the Position object and TicTacToe as well.

  5. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Ankit Kumar Chauhan
Ankit Kumar Chauhan
2012-05-09 07:06:32 - In reply to message 4 from Amin Saeidi
I was doing like

making options as global array.

new TicTacToe('board', options); in TicTacToe.js in case Const.COM after alert('You lost'); I am using javascript if(confirm()){} as
if(confirm('Start again!!!')){
new TicTacToe('board', options);
}

am I doing right?

but how to re instantiate position object. please guide me

  6. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Amin Saeidi
Amin Saeidi
2012-05-09 07:26:28 - In reply to message 5 from Ankit Kumar Chauhan
You can reset all the cells manually (e.g. in a for loop) or you may add a method to Position to reset the board to [0, 0, 0, 0, 0, 0, 0, 0, 0]

  7. Re: how to restart the game after finishing it without page refr   Reply   Report abuse  
Picture of Ankit Kumar Chauhan
Ankit Kumar Chauhan
2012-05-09 07:39:31 - In reply to message 6 from Amin Saeidi
but where to put this values.
can you please write me 2-3 lines for that. This will be great help for me.

Thanx