#
# TODO define a class for the rank table. We might also need it for scoring in
# other games.
+#
+# TODO when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds
# Class for storing question/answer pairs
QuizBundle = Struct.new( "QuizBundle", :question, :answer )
@question = nil
@answer = nil
@answer_core = nil
- @answer_array = [] # Array of UTF-8 characters
+ # FIXME 2.0 UTF-8
+ @answer_array = []
@first_try = false
- @hint = nil
+ # FIXME 2.0 UTF-8
+ @hint = []
@hintrange = nil
@hinted = false
# Function that returns whether a char is a "separator", used for hints
#
def is_sep( ch )
- return ch !~ /\w/u
+ return ch !~ /^\w$/u
end
q.first_try = true
- q.hint = ""
+ # FIXME 2.0 UTF-8
+ q.hint = []
q.answer_array.clear
q.answer_core.scan(/./u) { |ch|
if is_sep(ch)
when 1..1000 then 1
end
+ # FIXME 2.0 UTF-8
num_chars.times do
begin
index = q.hintrange.pop
m.reply "Hint: #{q.hint}"
q.hinted = true
- if q.hint == q.answer_core
+ # FIXME 2.0 UTF-8
+ if q.hint.to_s == q.answer_core
m.reply "#{Bold}#{Color}04BUST!#{Color}#{Bold} This round is over. #{Color}04Minus one point for #{nick}#{Color}."
stats = nil