# Trip into the future

 Einstein would have played this game (if he had a computer)

Here is the third installment of games from Usborne's Computer Space Games, translated into modern BASIC.

Trip into the future is a game about special relativity; a thought experiment that Einstein himself would recognise.  Imagine that you are able to travel in a spaceship at nearly the speed of light.  According to special relativity, time runs slower for you inside the spaceship than it does for the rest of us on Earth.  In this game you must arrive back on Earth after a certain number of years have elapsed by choosing a speed and distance to travel.  Remember, your journey will be shorter than the time as measured on Earth!

`      rem A Trip into the Future      rem By Daniel Isaaman and Jenny Tyler      rem Translated to BB4Win by Tim Street      rem ENSURE LOWERCASE KEYWORDS ARE ON!!!      *font Courier New, 20      target% = 5 : rem margin for error            repeat        print "Trip into the future"        printstring\$(20,"-")        rem time in years which must elapse before you return        trip% = rnd(100)+25   : rem (on Earth)                rem display instructions        print "You wish to return "str\$(trip%)        print"years into the future."'                print"Enter speed of your ship as a"        print"fraction of the speed of light."'        rem get user input                rem enter speed of ship        repeat          input "Speed (0.00 < v < 1.00) : " vel        until vel>0 and vel<1                input "Distance of trip : " dist                rem time elapsed at this speed as measured        rem inside the spaceship        t1 = dist / vel                rem time elapsed at this speed as measured        rem on Earth        t2 = t1 / (sqr(1-vel^2))                rem display results        print''"You took "str\$(t1)" years"        print"and arrived "str\$(t2)" years in the future."                if t1 > 70 then          print '"You died of old age on the way!"        else          rem check whether the time taken (on Earth)          rem is close to the target          if abs(trip% - t2)<= target% then            print '"You arrived within "str\$(target%)" years."            print  "CONGRATULATIONS!"          else            print '"Not even close!"          endif        endif                print''"(Press any key to go again...)"'        g% = get        cls      until false           `