change if to switch-case of key input function
change cell from 2-dim array to 1-dim array