public MainWindow() { InitializeComponent(); IsAI.Add(TakPiece.PieceColor.Black, false); IsAI.Add(TakPiece.PieceColor.White, false); AIs.Add(TakPiece.PieceColor.Black, new PlayerAI(TakPiece.PieceColor.Black, new GameState(new TakBoard(3)))); AIs.Add(TakPiece.PieceColor.White, new PlayerAI(TakPiece.PieceColor.White, new GameState(new TakBoard(3)))); DebugArea = DebugTrace; }
public void Generate(int popNumber, double mutationRate, double crossoverRate, double perturbationLimit, int eliteNumber, int eliteCopyNumber) { ga = new GeneticAlgorithm(popNumber, mutationRate, crossoverRate, perturbationLimit, eliteNumber, eliteCopyNumber); for (int i = 0; i < popNumber; i++) { NeuralNet nn = new NeuralNet( 220, 4, 3, 110, 1.0 ); Genome g = new Genome(nn.GetWeigths(), 0); AIs.Add(new ArtificialIntelligence() { NeuralNet = nn, Genome = g, Name = nameGenerator.GenerateRandomFirstName() + " " + CurrentGeneration }); } }
/// <summary> /// Adds a specified <see cref="AI"/> to the register /// </summary> /// <param name="ai">The <see cref="AI"/> to add</param> public static void AddToRegister(AI ai) { AIs.Add(ai); }
private void _CreateAiDynamic(Info.AiInfo info) { var actions = new List <IAction>(); foreach (var actioninfo in info.Actions) { var newAction = Actions.Create(actioninfo.RefAction); if (newAction == null) { throw new NullReferenceException(); } newAction.Initialize(actioninfo); actions.Add(newAction); } var considerations = new List <IConsideration>(); foreach (var considerationinfo in info.Considerations) { var newConsideration = Considerations.Create(considerationinfo.RefConsideration); if (newConsideration == null) { throw new NullReferenceException(); } newConsideration.Initialize(considerationinfo); considerations.Add(newConsideration); } var options = new List <IOption>(); foreach (var optionInfo in info.Options) { var action = actions[optionInfo.ActionInfoIndex]; var subConsiderations = new List <IConsideration>(); foreach (var indexConsideration in optionInfo.ConsiderationInfoIndexes) { subConsiderations.Add(considerations[indexConsideration]); } var newOption = new DynamicOption(action, subConsiderations, optionInfo); options.Add(newOption); } var behaviours = new List <IBehaviour>(); foreach (var behaviourInfo in info.Behaviours) { var subOptions = new List <IOption>(); foreach (var indexOption in behaviourInfo.OptionInfoIndexes) { subOptions.Add(options[indexOption]); } var subConsiderations = new List <IConsideration>(); foreach (var indexConsideration in behaviourInfo.ConsiderationInfoIndexes) { subConsiderations.Add(considerations[indexConsideration]); } var newBehaviour = new DynamicBehaviours(subOptions, subConsiderations, behaviourInfo); behaviours.Add(newBehaviour); } var newAi = new DynamicAi(behaviours); AIs.Add(newAi); }
public void AddAI(string name, string location) { AIs.Add(Board, name, location); }