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.
 
 

28 lines
665 B

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