Last active
November 4, 2019 04:16
-
-
Save IntegerMan/eb88c04262e15e2425efb390b6c96120 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MattEland.FSharpGeneticAlgorithm.WindowsClient.ViewModels | |
{ | |
internal class MainViewModel : NotifyPropertyChangedBase | |
{ | |
public MainViewModel() | |
{ | |
RandomizeCommand = new ActionCommand(RandomizeBrain); | |
BrainCommand = new ActionCommand(GetArtificialIntelligenceMove); | |
ResetCommand = new ActionCommand(Reset); | |
RandomizeBrain(); | |
Reset(); | |
} | |
public ActionCommand RandomizeCommand { get; } | |
public ActionCommand ResetCommand { get; } | |
public ActionCommand BrainCommand { get; } | |
private void RandomizeBrain() => | |
Brain = new BrainInfoViewModel(Genes.getRandomChromosome(_random)); | |
private void GetArtificialIntelligenceMove() => | |
State = Simulator.handleChromosomeMove(_state, _random, Brain.Model); | |
private BrainInfoViewModel _brain; | |
public BrainInfoViewModel Brain | |
{ | |
get => _brain; | |
set { | |
if (_brain != value) | |
{ | |
_brain = value; | |
OnPropertyChanged(); | |
} | |
} | |
} | |
// Old code omitted for simplicity | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment