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
693 B
27 lines
693 B
import * as GridActions from '../../actions/board/grid.actions';
|
|
import FactorsModel from '../../models/factors.model';
|
|
import SETTINGS from '../../AppSettings';
|
|
|
|
let values;
|
|
let dispatch;
|
|
|
|
const GridCtrl = {
|
|
setDispatch: d => dispatch = d,
|
|
getValues: () => values,
|
|
|
|
generateValues: (level) => {
|
|
values = FactorsModel.generate(SETTINGS.GRID_WIDTH * SETTINGS.GRID_HEIGHT, level);
|
|
dispatch(GridActions.update(values));
|
|
},
|
|
|
|
isCompleted: (level) => {
|
|
return FactorsModel.checkComplete(values, level)
|
|
},
|
|
|
|
hideValue: (index) => {
|
|
values[index].show = false;
|
|
dispatch(GridActions.update(values));
|
|
}
|
|
};
|
|
|
|
export default GridCtrl;
|
|
|