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() );