import { equals } from '@typed/common' ; import { any } from '@typed/logic' ; import { Direction , Grid } from '../model' ; import { convertSizeToBounds } from './convertSizeToBounds' ; import { moveTilesInDirection } from './moveTilesInDirection' ; import { sortTilesForDirection } from './moveTilesInDirection/sortTiles' ; export function checkHasRemainingMoves ( { size , tiles } ) { const bounds = convertSizeToBounds ( size ) ; return any ( direction => ! equals ( sortTilesForDirection ( direction , tiles ) , sortTilesForDirection ( direction , moveTilesInDirection ( bounds , direction , tiles ) ) ) , [ Direction . Up , Direction . Down , Direction . Left , Direction . Right ] ) ; }