Web Application Project
# Ruby code file - All your code should be located between the comments provided. # Add any additional gems and global variables here require 'sinatra' # The file where you are to write code to pass the tests must be present in the same folder. # See http://rspec.codeschool.com/levels/1 for help about RSpec require "#{File.dirname(__FILE__)}/wad_ms_gen_01" # Main program module MS_Game @input = STDIN @output = STDOUT g = Game.new(@input, @output) playing = true input = "" option = 0 turn = 0 placed = nil @output.puts 'Enter "1" runs game in command-line window or "2" runs it in web browser.' game = g.getinput if game == "1" @output.puts "Command line game" elsif game == "2" @output.puts "Web-based game" else @output.puts "Invalid input! No game selected." exit end if game == "1" # Any code added to command line game should be added below. # g.start # Any code added to output the activity messages to the command line window should be added above. exit # Does not allow command-line game to run code below relating to web-based version end end # End modules # Sinatra routes # Any code added to output the activity messages to a browser should be added below. # Any code added to output the activity messages to a browser should be added above. # End program