Appendix  E
Egghead

Egghead is a general game player that embodies the main ideas discussed in this book. It plays respectably, but it is by no means the best general game player in existence.

One reason is that it illustrates only the most basic versions of the ideas discussed here. For example, it does Monte Carlo; but it does not implement the UCT enhancement of Monte Carlo.

It is also non-ideal from a software engineering perspective. The code was written for readability / understandability, not efficiency. While the code can be used as written, there are numerous ways it can be improved by better software engineering. For example, representing entities and relations and variables as unique data structures could decrease the cost of comparisons. Avoiding the copying of sequences could also help. And data indexing could significantly enhance the runtime of this code.

The implementation shown here was designed to be used in conjunction with the subroutines defined in the preceding appendices, i.e. the server code, the game graph search code, the propositional net code, and the logical reasoning code.

The code here has been used in a wide variety of demonstrations and appears to work without flaws. However, only limited quality assurance methodology has been applied, and so there may be cases where the code does not behave as expected. Reader beware.

//------------------------------------------------------------------------------ // gameplayer.js //------------------------------------------------------------------------------ var documentation = ''; var rulesheet = ''; var stylesheet = ''; var javascript = ''; //------------------------------------------------------------------------------ // doexport //------------------------------------------------------------------------------