public static ElementsMatchGameState ConcealAllElementsAction(ElementsMatchGameState state) => state.With ( elementStates: state.ElementStates.Values .Select(x => x.With(concealed: true)) .ToDictionary(x => x.AtomicNumber).AsReadOnly() );
public static ElementsMatchGameState RevealElementAction(ElementsMatchGameState state, RevealElementAction action) => state.With ( elementStates: state.ElementStates.Values .Select(x => x.AtomicNumber != action.AtomicNumber ? x : x.With(concealed: false)) .ToDictionary(x => x.AtomicNumber).AsReadOnly() );
public static ElementsMatchGameState StartGameAction(ElementsMatchGameState state) => ElementsMatchGameStateExtensions.DefaultState.With ( matchType: state.MatchType, elementStates: ElementsMatchGameStateExtensions.DefaultState.ElementStates.Values .Select(x => x.With ( back: x.Back.With ( showName: state.MatchType != MatchType.PlaceTheName, showSymbol: state.MatchType != MatchType.PlaceTheSymbol ) )) .ToDictionary(x => x.AtomicNumber).AsReadOnly() );
public static ElementsMatchGameState SetExpectedElementAction(ElementsMatchGameState state, SetExpectedElementAction action) =>
public static ElementsMatchGameState SelectGameAction(ElementsMatchGameState state, SelectGameAction action) => ElementsMatchGameStateExtensions.DefaultState.With(matchType: action.MatchType);