コード例 #1
0
        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);
        }
コード例 #2
0
        public static void Save(
            StateValueTable stateValues,
            string name,
            string description,
            string path)
        {
            var table = new SerializableStateValueTable(name, description, stateValues.Tile);

            table.SetStateValues(stateValues);
            File.WriteAllText(path, JsonSerializer.Serialize(table, BuildJsonOptions()));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public GreedyStateValuePlayer(StateValueTable stateValues, BoardTile tile)
 {
     _stateValues = stateValues;
     Tile         = tile;
 }