I'm trying to code a live chess game with no java script. My idea was to use php to handle most of the things js would usually, and have is update the sql data base. Is there any way i can just forego the sql data base and not have to us js, or is there anyway i can update the sql database using only php or html?
Instead of a DB you can use plain files named after the games id and store the game state there as a json dump.
Turns are done via a post form, and players identified by their cookies.
After doing your turn you would have to refresh the site until it's your turn again, you need JS at least for that.
It would be easier with JS which periodically checks for game state changes and if it's your turn and updates the board.
If it is a game against the computer you can just carry around the full state of the game, it's not that big.
>>2
I would be perfectly fine for correspondence chess but quite impractical for a blitz game.
>>2
Json is overkill, just store algebraic notation for each turn one per line. Then you can just have one parser that you use for both the UI and the save file.
>>1
I did this in C once. No you don't need JS, set the form submission URL to your "API" and when you get form data hold the socket open until the other player finishes their turn then send the updated chess board with a new form. Have them enter their moves in algebraic notation.
>>5
What happens if the client disconnects? You can't call it back with HTTP.
>>6
You'd notice (I had it send a "." every second so you knew it was still connected) and refresh and the server would ask what team you're on.
This way you can come back to games you're playing. I also wanted resume since it had a tty interface (it would check if argv[0] ended in "cgi" and present the html/tty interface accordingly.)