You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
709 B

import * as GridActions from '../../actions/board/grid.actions';
import SubtractionModel from '../../models/subtraction.model';
import SETTINGS from '../../AppSettings';
let values;
let dispatch;
const GridCtrl = {
setDispatch: d => dispatch = d,
getValues: () => values,
generateValues: (level) => {
values = SubtractionModel.generate(SETTINGS.GRID_WIDTH * SETTINGS.GRID_HEIGHT, level);
dispatch(GridActions.update(values));
},
isCompleted: (level) => {
return SubtractionModel.checkComplete(values, level)
},
hideValue: (index) => {
values[index].show = false;
dispatch(GridActions.update(values));
}
};
export default GridCtrl;