Refactoring is done by changing variable name, using stricter condition

Smaller changes:
* remove unnecessary imports
* remove unnecessary comment
Implement the part that sets the next movable grid

Due to confusion on data structure and the hard-coded example, this
implementation is not yet tested.