refactoring tri.js
keyboard movement control