public HierarchicalNGramPredictor(int n) { nValue = n; ngrams = new NGramPredictor[nValue]; for (int i = 0; i < nValue; i++) { ngrams[i] = new NGramPredictor(); ngrams[i].nValue = i + 1; ngrams[i].Init(); string filename = "StoreNGram" + i + ".dat"; object temp = ReadFromFile(filename); if (temp != null) ngrams[i].data = (Hashtable)temp; } }
// Use this for initialization void Start() { previousCube = CubeType.none; gameLogicScript = GameObject.Find("GameLogic").GetComponent<gamelogic>(); if(isAINgram){ ngramPredictor = new NGramPredictor(); ngramPredictor.Start(); ngramPredictor.nValue = NgramWindowSize + 1; ngramPredictor.doDebugLogs = doDebugLogs; ngramPredictor.playerThisNgramPredictorBelongsTo = this.gameObject.ToString(); } otherPlayerScript = gameLogicScript.returnOtherPlayer(this); //track previous actions if other player uses ngrams if(otherPlayerScript.isAINgram){ previousCubePicks = new CubeType[otherPlayerScript.NgramWindowSize + 1]; for (int i = 0; i < previousCubePicks.Length; i++) previousCubePicks[i] = CubeType.none; } }