I've been considering making an AI for any game for any very long time, and lately I have began to collect assets and calculations. The overall game is non-random, and more often than not, there < 3 moves for any player, sometimes, you will find >20 moves. I must store critical moves, or ambiguous moves to ensure that the AI discovers from the mistakes and won't create a same mistake next time. Moves that surely successful or unsuccessful do not need to be saved. And So I really possess a sparse decision tree for the start of games. I must understand how I ought to store this decision tree inside a database? The database need not be SQL, and I don't know which database is appropriate with this particular problem.

EDIT: Please not let me know to parse your decision tree into memory, consider the overall game as complicated as chess.

Because you will be crossing the tree, neo4j appears like a great choice in my experience. SQL isn't any sensible choice due to the numerous joins you'd requirement for queries. When i comprehend the question, you're requesting a method to store some graph inside a database, and neo4j is really a database explicitely for graphs. For that sparseness, you are able to attach arrays of primitives or Strings towards the edges of the graph to scribe sequences of moves, using PropertyContainers (am i right that by sparseness and missing of nodes you mean your tree-edges are sequences of moves instead of single moves?).

I'd make use of a document database (NOSQL) like RavenDB since you can store data structure within the database.

Documents aren't flat as with an ordinary SQL database which enables you to definitely store hierarchical data like trees directly:

   decision: 'Go forward', 
   childs: [ 
      { decision: 'Go backwards' },
         decision: 'Stay there',
         childs: [
            { decision: 'Go backwards' }

Here you can observe a good example JSON tree which may be saved in RavenDB.

RavenDB also offers a built-in feature to question hierarchical data: http://ravendb.internet/faq/hierarchies

Please consider the documentation to obtain more information how RavenDB works.


You should use memory planned file as storage. First, create "compiler". This compiler will parse text file and convert it into compact binary representation. Primary application will map this binary enhanced file into memory. This can solve your condition with memory size limitation

Begin with an easy database table design.

Choices: CurrentState BINARY(57) NewState BINARY(57) Score INT

CurrentState and NewState really are a serialized version of the overall game condition. Score is really a weight provided to the NewState (positive scores are great moves, negative scores can be harmful moves) your AI can update these scores properly.

Renju, utilizes a 15x15 board, each location could be either black, whitened or empty which means you need Ceiling( (2bits * 15*15) / 8 ) bytes to serialize the board. In SQL that might be a BINARY(57) in T-SQL

Your AI would choose the present moves it's saved like...

SELECT NewState FROM Decisions WHERE CurrentState = @SerializedState ORDER BY Score DESC

You will get a listing of all of the saved next moves in the current game condition so as of best score to least score.

Your table structure might have an amalgamated Unique Index (primary key) on (CurrentState, NewState) to facilitate searching and steer clear of replicates.

This is not the very bestOrmost optimal solution, but due to your insufficient DB understanding I beleive it might be the simplest to implement and provide you with an excellent start.