Select Git revision
SolutionOrganizer.cs
-
Marco Zimmer authoredMarco Zimmer authored
SolutionOrganizer.cs 6.55 KiB
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using Newtonsoft.Json;
using static CommunicationEvents;
/// <summary>
/// Solution of a <see cref="Stage"/>
/// </summary>
public class SolutionOrganizer : FactOrganizer, IJSONsavable<SolutionOrganizer>
{
/// @{ <summary> adds to the end of the file name of a </summary>
private const string
/// <summary> SolutionFile (stores <see cref="SolutionOrganizer">this</see>) </summary>
endingVal = "_val";
/// @}
/// <summary>
/// A collection of constrains of which *all* have to be <see langword="true"/>
/// <seealso cref="SubSolution"/>
/// <seealso cref="FactOrganizer.DynamiclySolved(SolutionOrganizer, out List<List<string>>, out List<List<string>>)"/>
/// </summary>
public List<SubSolution> ValidationSet;
/// <summary>
/// Sits at the heart, but represents only a part of the whole Solution.
/// </summary>
public class SubSolution
// needs to be public for JSONWriter
{
/// <summary>
/// entails <b>{<see cref="FactOrganizer.FactDict">SolutionOrganizer.FacDict.Values</see>}</b> <br/>
/// <see cref="FactOrganizer.FactDict">SolutionFacts</see> to relate from.
/// </summary>
public HashSet<string> MasterIDs = new HashSet<string>();
/// <summary>
/// entails <b>{[],[0, <see cref="SolutionOrganizer.ValidationSet"/><c>.IndexOf(<see cref="SubSolution">this</see>)</c> - 2]}</b> <br/>
/// Marks LevelFacts (<see cref="StageStatic.stage.factState"/>) found as solution (<see cref="FactOrganizer.DynamiclySolved(SolutionOrganizer, out List<List<string>>, out List<List<string>>)"/>)
/// in a previous entry of <see cref="SolutionOrganizer.ValidationSet"/><br/>
/// to relate from *in addition* to <see cref="MasterIDs"/> <br/>
/// or _none_ if <c>empty</c>
/// </summary>
public List<int> SolutionIndex = new List<int>();
/// <summary>
/// entails <b>{[],[0, <see cref="SolutionOrganizer.ValidationSet"/><c>.IndexOf(<see cref="SubSolution">this</see>)</c> - 2]}</b> <br/>
/// Marks LevelFacts (<see cref="StageStatic.stage.factState"/>) found as solution (<see cref="FactOrganizer.DynamiclySolved(SolutionOrganizer, out List<List<string>>, out List<List<string>>)"/>)
/// in a previous entry of <see cref="SolutionOrganizer.ValidationSet"/><br/>
/// to relate to *instead of* all LevelFacts (<see cref="StageStatic.stage.factState"/>) <br/>
/// or _none_ if <c>empty</c>
/// </summary>
public List<int> RelationIndex = new List<int>();
/// <summary>
/// Comparer defining relation between <see cref="FactOrganizer.FactDict">SolutionFacts</see> and LevelFacts (<see cref="StageStatic.stage.factState"/>)
/// </summary>
[JsonIgnore]
public FactComparer Comparer = new FactEquivalentsComparer();
/// <summary>
/// Enables (especially <see cref="JsonConverter"/>) to read and set <see cref="Comparer"/> by its <c>string</c> representation.
/// </summary>
public string ComparerString
{
get { return Comparer.ToString(); }