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
658 B

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