full rewrite Game grid/tile logic from original js implementation