public void LoadSavedMap_IsNotNull() { const string filePath = "BoardActionMapTests_LoadSave.test.json"; var stateValues = new StateValueTable(BoardTile.X); PolicyFileIo.Save(stateValues, "name", "description", filePath); var loadedStateValues = PolicyFileIo.LoadStateValueTable(filePath); Assert.IsNotNull(loadedStateValues); }
public void TryFromFile_ReturnsFalse_WhenFileIsInvalid() { const string path = "TryFromFile_ReturnsFalse_WhenFileIsInvalid.invalidFile.json"; File.WriteAllText(path, "{}"); var result = PolicyFileIo.TryFromFile(path, out var policy); Assert.IsFalse(result); Assert.IsNull(policy); }
public void SaveAndLoad() { const string name = "name"; const string description = "description"; const string filename = "PolicyFileIoTests.SaveAndLoad.json"; var stateValues = new StateValueTable(BoardTile.X); PolicyFileIo.Save(stateValues, name, description, filename); var policy = PolicyFileIo.FromFile("PolicyFileIoTests.SaveAndLoad.json"); Assert.AreEqual(name, policy.Name); Assert.AreEqual(description, policy.Description); }
public void Saves_And_Loads() { var opponent = new FirstAvailableSlotPlayer(BoardTile.O); _1StepAgent.Train(opponent, 1); var path = $"{nameof(NStepAgentTests)}.{nameof(Saves_And_Loads)}.agent.json"; _1StepAgent.SaveTrainedValues("asdf", path); var stateValueTable = PolicyFileIo.LoadStateValueTable(path); Assert.NotNull(stateValueTable); }
public void Saves_And_Loads() { var agent = new MonteCarloTicTacToeAgent(BoardTile.X); var opponent = new FirstAvailableSlotPlayer(BoardTile.O); agent.Train(opponent, 1); var path = $"{nameof(MonteCarloTicTacToeAgentTests)}.{nameof(Saves_And_Loads)}.agent.json"; agent.SaveTrainedValues("asdf", path); var stateActionTable = PolicyFileIo.LoadStateActionTable(path); Assert.NotNull(stateActionTable); }