Video

Computer simulations teaching themselves to walk

This is hilarious.

More info about this: http://goatstream.com/research/papers/SA2013/index.html

Advertisements

Python: getting the time

(I can never come up with good blog titles.)

Anyway, this is a Python script to get the time, but not in the normal boring way of simply presenting numbers. Instead, this shows it in words.

import datetime
import sys

now = datetime.datetime.now()
hour = now.hour
hour2 = hour
minute = now.minute

if hour == 12:
    time = "noon"
elif hour == 0 or hour == 24:
    time = "midnight"
elif hour >= 3 and hour < 12:
    time = "in the morning"
elif hour > 12 and hour <= 21:
    time = "in the afternoon"
elif hour > 21 or hour < 3:
    time = "at night"

if time == "noon" or time == "midnight":
    print(time)
    sys.exit()

if hour > 12:
    hour -= 12
if minute <= 30:
    sep = "after"
else:
    sep = "until"
    minute = 60 - minute
    hour += 1
    hour2 += 1
    if hour > 12:
        hour -= 12
    if minute == 0:
        print("%d %s" % (hour, time))
        sys.exit()

if hour2 == 0 or hour2 == 24:
    print("%d %s midnight" % (minute, sep))
elif hour2 == 12:
    print("%d %s noon" % (minute, sep))
else:
    print("%d %s %d %s" % (minute, sep, hour, time))

So if the time was 4:37 PM (which it is as I’m writing this), it will show “23 until 5 in the afternoon”. Other possibilities include “noon”, “midnight”, “14 after 6 in the morning”, “1 at night”, “23 after noon”, etc.

Getting a new computer

So, I’ll be getting a new computer in about a week or so. It’s a Toshiba Satellite P855-S5200, and is pretty good.

Specs if anyone is interested:

  • Intel Core i7-3610QM (quad-core, 2.3 GHz with Turbo Boost up to 3.3 GHz, 6 MB L3 cache)
  • Mobile Intel HD graphics, 64 MB – 1696 MB dynamically allocated graphics memory
  • 750 GB 5400 rpm Serial ATA HDD
  • 8 GB DDR3 1600 MHz
  • I’m too lazy to post the rest.

It’s rather better than my current computer, which is an IBM ThinkPad T41. (With an Intel Pentium M 1.6 GHz processor, 1 GB RAM, and 160 GB HDD. Hey, it’s not bad if you live in 2003.)

After I get it it might be a while before a post anything new about my programming stuff, as I’ll have to get it everything installed, and files copied over, and all that.