Friday, 13 June 2008


I am in the process of writing up the plans for a little experiment. I have written a script that generates 10 mathmatical sums(+) using two digit numbers. The user is timed answering these questions. Thats not all, the user performs two normal runs of this script with 30mins in between and then starts drinking one pint in between each round of questions. The script records how many correct answers the user inputs and how long the user takes. My hypothesis is that there will be a peak efficiency level some time after the user starts drinking. I am factoring into this the knowledge that after the first hour the body metabolises one unit of alcohol per hour.

This experiment is largely inspired by Randal Munroe of xkcd both in a comment he made regarding rubix cubes during a talk at MIT. and this strip.

Heres a copy of my largely inefficient script (but it still works)

puts "Enter Contestant Name -"
name = gets.to_s.chomp
puts "Current Units Consumed?"
units = gets.chomp.to_i
count = 0
score = 0

time =
start = time.to_i

while count != 10 do
first = rand(99)
second = rand(99)
puts first.to_s + " + " + second.to_s + " = "
result = gets.to_i
if result == first.to_i+second.to_i
then score = score.succ
count = count.succ
final = score.to_s + "/10"
puts final

time =
finish = time.to_i

speed = finish - start, "a+") { |f|
f << units.to_s + " Units Consumed - " + final.to_s + " in " +
speed.to_s + " Seconds"
f << "\n"

No comments: