const Immutable = require('immutable'); import * as MuncherActions from '../../actions/board/muncher.actions'; import MuncherCtrl from '../../controllers/muncher.controller'; import { SETTINGS } from '../../App'; const initial = { x: 0, y: 0, frozen: false }; const reducer = (state = initial, action) => { if (action.type !== MuncherActions.MUNCHER_ACTION) { return state; } if (action.action === MuncherActions.UPDATE) { return Immutable.Map(state) .set('x', MuncherCtrl.getX()) .set('y', MuncherCtrl.getY()) .set('frozen', false) .toObject(); } return state; }; export default reducer;