work on tile cut alg