Noughts and crosses game using client side javascript (JQuery) in a webpage
- From: "Jacob Kruger" <jacobk@xxxxxxxxxxxxxx>
- To: <ProgrammingBlind@xxxxxxxxxxxxx>
- Date: Tue, 14 Sep 2010 22:12:41 +0200
Check out:
http://blindza.co.za/noughtsAndCrosses/
It uses the JQuery javascript library to implement a form of dynamic HTML,
including sound effects, and visual effects in a simple version of
ticTacToe/noughts and crosses, and all the logic/pseudo-AI is included in the
client-side javascript, which is hidden in a script source PHP file so that you
can't access it from the browser, using sort of alternating session variables,
which makes it only render correctly if it's sort of called from the actual
interface page, etc.
Comes to a total of around 214 lines of javascript scripting, and I just
appreciate the fact that JQuery really lets use implement/make use of DHTML,
including querying element attributes easily enough, and I even implemented
some minor dynamic style sheeting class changes to render visual effects, apart
from changing the interface buttons' text values, etc.
One thing still plan to try out is a way of rendering the sound effects a bit
more quickly than just reloading the hidden inline frames that have their
background sounds being made use of - will maybe try to either load each of
them in a separate inline frame and then just refresh them since the browser
might then make use of a cached sound file instance at each refresh trigger,
but that would also, obviously, render a bit of 'noise' in the beginning, so
not 100% sure as of yet, but anyway.
Lastly, my version of AI made use of here is to just get it to check possible
combinations of available buttons, by looping through the combo's to check the
sort of current button value states, and then choose which move to make next
like that.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5451 (20100914) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Other related posts: