rewrite snake_ui.js