Hexagon FAQs
What algorithm does the computer use?
JScript is a difficult thing to read even with comments. Here is a summary of
the algorithm:
The computer determines its move by firstly scanning the board from top to bottom, left to right.
Whenever it finds one of its tokens it looks at all of its possible moves. It
calculates in turn the total number of tokens it will gain by making each of these possible moves. If it needs to perform a 'jump'
then it will subtract the number of tokens it leaves exposed in executing the jump.
It records the best move and then executes it. (See the "MakeComputersMove" and "FindBestMove" Javascript functions)
How does it record the overall results?
The pages had to be clever enough to stop people going to the results screen,
pressing refresh a dozen times and expecting the overall results to increase. To
avoid this, when the hexagons main page is generated, the ASP code inserts the session.sessionid
into the query string that is passed to the results.aspx page. (results.aspx is the one
that displays "Win", "Lose" or "Draw".) This id is a unique number automatically assigned to each visitor.
When the results.aspx page is requested, the
sessionid in the query string is compared against actual session id. If they are the same
then the results are displayed and recorded. If this is not the case then it does not
necessarily mean that some one is trying to circumvent the system because there is a
chance that the game took a long time to play and the session timed out. When this
happens the results are just displayed and not recorded.
This seems to work well but some users have complained that they have won three games in a row but it has not been recorded. They are generally less than impressed.
Why does it only work with IE4 or later?
It should work with every browser but we were a little lazy with this one and did not want to investigate the intricate details of DOM and javascript as applied to the major browsers.
Humanity Vs Technology?
Sure it's a gimmick, but gosh its interesting! Even though I wrote the program, I still
lose about 60% of the time. Better players seem to win about 70% of the time.
|