I worked on my HTTP-based tic-tac-toe project. I can now play the game on the console with:
1 ruby play_console.rb
Or via HTTP (using Sinatra) with:
1 ruby play_http.rb
I am still figuring out how to do testing with Sinatra. It looks fairly straight forward but the part I remain unclear about is redirects. So I’m looking into that next. The game uses POST when the human/HTTP player makes a move but uses a GET when choosing if the human/HTTP player would like to be X or O. That should probably be a POST but doing a nice clean prompt for X or O and submitting the result with a POST is not as clean as I’d like. Maybe another attempt or two will result in something that is cleaner.
For more details, see the TicTacToeHttp class…