I have a quiz-like javascript game and it is supposed to be fast-paced. The user needs to answer as many questions as he can in a short time. He is presented with a Yes/No question, the answer is sent to the server, validated there and a feedback (correct/incorrect) is shown back to him. I use Javascript and AJAX.
The problem is the delay in between two consecutive questions due to the verification going on at the server. The questions are independent of each other (the outcome does not change the next question). I want the user get a feedback immediately after his answer and only then see the next question.
Currently, I stop the clock on the client-side while the answer is being validated on the server side and resume it once the feedback along with the next question arrives. I also make sure, at the server side, a game session does not exceed the allowed time plus a reasonable slack for the network delays.
The only and obvious solution I can think of to eliminate the delay is to send a batch of questions to the client along with the answers and do the verification on the client side. That would minimize the communication with the server (once per session) and provide a smooth playing experience. Obviously, any user who can read the incoming messages can create a script that would play automatically and play perfectly. Obfuscating the client code and the answer could help a bit and increase the cost of writing such a malicious script but it wouldn't eliminate a determined user to create his own script.
My question is two-fold. First, I want to be sure I'm not making a huge mistake and missing an obvious solution to this problem which also perfectly handles users with bad intentions. I guess it's theoretically impossible to come up with such a solution but I don't have enough place to write down the proof here (!).
Second, given that there is no money reward at the end of the game, I don't expect any bored coders to mess with my little game. But still, I would like to hear your opinions and your strategies to deal with it in more serious cases.