Developer's note:  Written in Bash for my RC application, now running in a remote Node.js shell connected to a terminal front-end.
Expert computer player uses the minimax algorithm.