« back

Tic-Tac-Toe Ui-From Console to Web with Sinatra

04 Sep 2012

Moving my Tic-Tac-Toe Ui from a command line app to a web app has different concerns. One of the main differences is the way to gather the information.

In the console I spit out text, wait for input from the user, and then spit out my next bit of text. When working on the web, In some areas I have a chance to streamline certain actions. For example, when creating players, I would need to get each player's type (human or computer) and the letter to represent each of them one at a time. When working on the web, I can collect all of this data and then send it one time through a form. I can still use the validations I set up and this is better than rendering one page for each piece of information I need to gather.

As far as gathering user input for moves, instead of having the user type in the number of the move they want to choose, I am using a form with a table inside of it. Each square is represented by a button in the table. I then use embedded ruby to display the values of the board in each button.

comments powered by Disqus