diff --git a/Gemfile b/Gemfile index d3b178e..dc421e8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,5 @@ source 'https://rubygems.org' - gem 'eventmachine' gem 'thin' gem 'sinatra' diff --git a/lib/extreme_startup/question_factory.rb b/lib/extreme_startup/question_factory.rb index 3734a54..9a707a0 100644 --- a/lib/extreme_startup/question_factory.rb +++ b/lib/extreme_startup/question_factory.rb @@ -316,6 +316,7 @@ class GeneralKnowledgeQuestion < Question class << self def question_bank [ + ["who created 'Il pulcino Pio'", "Lucio Scarpa"], ["who is the Prime Minister of Great Britain", "David Cameron"], ["which city is the Eiffel tower in", "Paris"], ["what currency did Spain use before the Euro", "peseta"], @@ -396,6 +397,29 @@ def scrabble_scores end end + require 'date' + class BeforeDateQuestion < Question + def initialize(player, date=nil) + if date + @date = Date.strptime(date, '%d-%m-%Y') + else + @date = Date.new(2013,rand(11) + 1,rand(27)+1) + end + end + + def points + 30 + end + + def correct_answer + @date.prev_day().strftime('%d-%m-%Y') + end + + def as_text + "what is the previous day of #{@date.strftime('%d-%m-%Y')}" + end + end + class QuestionFactory attr_reader :round @@ -407,6 +431,7 @@ def initialize MultiplicationQuestion, SquareCubeQuestion, GeneralKnowledgeQuestion, + BeforeDateQuestion, PrimesQuestion, SubtractionQuestion, FibonacciQuestion,