public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { var result = Validate(game.World, dictVariables); if (game.Guess) { var questionMessage = new Question(game, this, "Choose a formula that you believe to be true.", CreatePossibleSelection(true, dictVariables)); var allTrueInfo = new InfoMessage(game, this, $"So you believe that at least one of these formula is true:\n{ArgumentsToString(dictVariables)}[You will try to choose a true formula]", questionMessage); return(new InfoMessage(game, this, $"So you believe that\n{ReformatFormula(dictVariables)}\nis true?", allTrueInfo)); } else { AMove invalidMove = null; if (result.Value == EValidationResult.False) { invalidMove = _invalidFormula.CreateNextMove(game, dictVariables); } else { invalidMove = _validFormula.CreateNextMove(game, dictVariables); } var allTrueInfo = new InfoMessage(game, this, $"So you believe that all of these formula are false:\n{ArgumentsToString(dictVariables)}[Bivalence World will try to choose a true formula]", invalidMove); return(new InfoMessage(game, this, $"So you believe that\n{ReformatFormula(dictVariables)}\nis false?", allTrueInfo)); } }
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { if (_type == EQuantumType.Exist) { return(CreateMoveExistQuantum(game, dictVariables)); } else { return(CreateMoveAllQuantum(game, dictVariables)); } }
private List <Question.Selection> CreatePossibleSelection(bool guess, Game.Game game, Dictionary <string, string> dictVariables) { var selection = new List <Question.Selection>(); foreach (var worldObject in game.WorldObjects) { selection.Add(new Question.Selection(guess, Arguments[0], dictVariables, worldObject, _variable.Name)); } return(selection); }
private Formula CreateFormulaWithoutFunctions(Game.Game game, Dictionary <string, string> dictVariables) { if (Arguments.Any(a => a is Function)) { return(new Equals(Arguments[0].CreateArgumentWithoutFunctions(game, dictVariables), Arguments[1].CreateArgumentWithoutFunctions(game, dictVariables))); } else { return(null); } }
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { var result = Validate(game.World, dictVariables); var withoutFunctionFormula = CreateFormulaWithoutFunctions(game, dictVariables); if (game.Guess) { if (withoutFunctionFormula != null) { var endMessage = new EndMessage(game, this, "You win:\n" + withoutFunctionFormula.ReformatFormula(dictVariables) + "\n is true in this world", true); if (result.Value == EValidationResult.False) { endMessage = new EndMessage(game, this, "You lose:\n" + withoutFunctionFormula.ReformatFormula(dictVariables) + "\n is false, not true, in this world", false); } var infoFunctionFormula = new InfoMessage(game, withoutFunctionFormula, $"So you believe that \n{withoutFunctionFormula.ReformatFormula(dictVariables)}\n is true", endMessage); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is true", infoFunctionFormula)); } else { var endMessage = new EndMessage(game, this, "You win:\n" + ReformatFormula(dictVariables) + "\n is true in this world", true); if (result.Value == EValidationResult.False) { endMessage = new EndMessage(game, this, "You lose:\n" + ReformatFormula(dictVariables) + "\n is false, not true, in this world", false); } return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is true", endMessage)); } } else { if (withoutFunctionFormula != null) { var endMessage = new EndMessage(game, this, "You win:\n" + withoutFunctionFormula.ReformatFormula(dictVariables) + "\n is false in this world", true); if (result.Value == EValidationResult.True) { endMessage = new EndMessage(game, this, "You lose:\n" + withoutFunctionFormula.ReformatFormula(dictVariables) + "\n is true, not false, in this world", false); } var infoFunctionFormula = new InfoMessage(game, withoutFunctionFormula, $"So you believe that \n{withoutFunctionFormula.ReformatFormula(dictVariables)}\n is false", endMessage); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is false", infoFunctionFormula)); } else { var endMessage = new EndMessage(game, this, "You win:\n" + ReformatFormula(dictVariables) + "\n is false in this world", true); if (result.Value == EValidationResult.True) { endMessage = new EndMessage(game, this, "You lose:\n" + ReformatFormula(dictVariables) + "\n is true, not false, in this world", false); } return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is false", endMessage)); } } }
private AMove CreateMoveAllQuantum(Game.Game game, Dictionary <string, string> dictVariables) { var result = Validate(game.World, dictVariables); if (game.Guess) { var infoVariable = new InfoMessage(game, this, $"So you believe that every object [{_variable.ReformatFormula(dictVariables)}] satisfiy\n{Arguments[0].ReformatFormula(dictVariables)}Bivalence World will try to find a counterexample", Arguments[0].CreateNextMove(game, SetResultVariableConstValue(result.Value, dictVariables, game))); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is true", infoVariable)); } else { var questionMessage = new Question(game, this, $"Choose a block that satisfies:\n{Arguments[0].ReformatFormula(dictVariables)}", CreatePossibleSelection(false, game, dictVariables)); var infoVariable = new InfoMessage(game, this, $"So you believe that some object [{_variable.ReformatFormula(dictVariables)}] does not satisfiy\n{Arguments[0].ReformatFormula(dictVariables)}You will try to find an instance", questionMessage); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is false", infoVariable)); } }
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { var result = Validate(game.World, dictVariables); if (game.Guess) { game.SetGuess(!game.Guess); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is true", _formula.CreateNextMove(game, dictVariables))); } else { game.SetGuess(!game.Guess); return(new InfoMessage(game, this, $"So you believe that \n{ReformatFormula(dictVariables)}\n is false", _formula.CreateNextMove(game, dictVariables))); } }
public Argument CreateArgumentWithoutFunctions(Game.Game game, Dictionary <string, string> dictVariables) { if (this is Function function) { var worldConstant = function.GetWorldConstant(game.World, dictVariables); var worldObject = game.WorldObjects.Find(obj => obj.Consts.Contains(worldConstant)); if (worldObject.Tags != null) { worldObject.Consts.Add(worldConstant); } game.AddTemporaryWorldObject(worldObject); return(new Constant(worldConstant, worldConstant)); } else { return(this); } }
private Formula CreateFormulaWithoutFunctions(Game.Game game, Dictionary <string, string> dictVariables) { if (Arguments.Any(a => a is Function)) { var arguments = new List <Argument>(); foreach (var argument in Arguments) { var newArgument = argument.CreateArgumentWithoutFunctions(game, dictVariables); arguments.Add(newArgument); } return(new Predicate(arguments, Name, Name)); } else { return(null); } }
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { return(new InfoMessage(game, this, $"{ReformatFormula(dictVariables)}\ncan be rewritten as\n{_rewrittenFormula.ReformatFormula(dictVariables)}", _rewrittenFormula.CreateNextMove(game, dictVariables))); }
private Dictionary <string, string> SetResultVariableConstValue(EValidationResult result, Dictionary <string, string> dictVariables, Game.Game game) { Dictionary <string, string> newDictionary = new Dictionary <string, string>(); var keyValue = new KeyValuePair <string, string>(); if (result == EValidationResult.True) { keyValue = _validConstPair; } else { keyValue = _invalidConstPair; } foreach (KeyValuePair <string, string> pair in dictVariables) { newDictionary.Add(pair.Key, pair.Value); } if (newDictionary.ContainsKey(keyValue.Key)) { newDictionary[keyValue.Key] = keyValue.Value; } else { newDictionary.Add(keyValue.Key, keyValue.Value); } if (keyValue.Value.StartsWith("n")) { var worldConstant = keyValue.Value; var worldObject = game.WorldObjects.Find(obj => obj.Consts.Contains(worldConstant)); if (worldObject.Tags != null) { worldObject.Consts.Add(worldConstant); } game.AddTemporaryWorldObject(worldObject); } return(newDictionary); }
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { throw new NotImplementedException(); }
public abstract AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables);
public override AMove CreateNextMove(Game.Game game, Dictionary <string, string> dictVariables) { return(_formula.CreateNextMove(game, dictVariables)); }