Philosophy

May 25, 2011 1 comment

According to XKCD, you can start at any Wikipedia article, and by continually clicking on the first non-italic, un-parenthesised link in the article text, eventually end up at “Philosophy.”

Let’s see how that works:

http://en.wikipedia.org/wiki/Wiki

http://en.wikipedia.org/wiki/Website


http://en.wikipedia.org/wiki/Web_page


http://en.wikipedia.org/wiki/Document


http://en.wikipedia.org/wiki/Non-fiction


http://en.wikipedia.org/wiki/Narrative


http://en.wikipedia.org/wiki/Latin


http://en.wikipedia.org/wiki/Italic_language


http://en.wikipedia.org/wiki/Indo-European_languages


http://en.wikipedia.org/wiki/Language_family


http://en.wikipedia.org/wiki/Language


http://en.wikipedia.org/wiki/Communication


http://en.wikipedia.org/wiki/Meaning_(philosophy_of_language)

http://en.wikipedia.org/wiki/Aristotle     <-----   Oh, so close!

http://en.wikipedia.org/wiki/Greeks


http://en.wikipedia.org/wiki/Nation


http://en.wikipedia.org/wiki/Sovereign_state


http://en.wikipedia.org/wiki/State_(polity)


http://en.wikipedia.org/wiki/Social_sciences


http://en.wikipedia.org/wiki/Umbrella_term


http://en.wikipedia.org/wiki/Superset


http://en.wikipedia.org/wiki/Mathematics


http://en.wikipedia.org/wiki/Quantity


http://en.wikipedia.org/wiki/Property_(philosophy)


http://en.wikipedia.org/wiki/Modern_philosophy

http://en.wikipedia.org/wiki/Philosophy     <-----   Achievement unlocked.

25 Steps from Wiki to Philosophy. Next step is to write a script to test the generalised case.

Or go out for a nice walk.

Categories: Uncategorized

That’s just a giant logo

April 25, 2010 3 comments

Lately I’ve been feeling quite nostalgic about the turtle graphic environment, Logo. Then I saw this and my new mini-obsession was confirmed:
marriedtothesea.com
[marriedtothesea.com]

I certainly have some fond memories of my early programming efforts in Logo. First on a Commodore 64, circa 9 years old, with some Logo disks borrowed from school. This version supported music and animation (sprites even!) and was great fun. I even had to learn trigonometry prematurely in order to complete the base of my leaning tower of Pisa (so that the bungee jumper had something to jump from.)

Later at high school we used Logo on the Amiga 500 as part of the scandalously brief computer studies curriculum. Who would of thought in 1992 that computers would be an important part of our future? Anyway I don’t remember this version having any particularly special capabilities. I do remember being set tasks such as “A working set of traffic lights” and “A cake with flickering candles” while the rest of the class was tasked with “a circle” or “a stack of squares”.

More recently, when I first discovered the Python programming language, the “turtle”  module in the standard library was the first method of creating graphics that I discovered. Thankfully I’ve discovered better methods since.

So what am I feeling so nostalgic for? The Lisp-like Logo programming language, or just turtle graphics in general? Probably a little of both. That is, I feel like I’d like to revisit the original Logo language, or even dive into learning Common Lisp. On the other hand, something like Cheloniidae looks like a lot of fun and that’s a Java library.

Either way, expect to see lots of circles and stacks of squares on this blog soon.

Categories: Uncategorized

Talking Python

April 25, 2010 Leave a comment

The following was a small amusement that I put together for my 5 year old daughter. It must have made quite the impression on her as she has informed me that she wants to be a “horse programmer” when she grows up.

This program relies on another program called “espeak” which should be present on most Linux systems. This is a command line tool which takes  text and converts it to speech. If you are using a Mac you could adapt the program to use the command “say” which does the same thing (the command line arguments are bound to be different though). Windows doesn’t include such a tool, because Microsoft just doesn’t love you, however Google turned up this result when I searched for “Windows command line speech”.

Apart from that you will see a few Python constructs which may be interesting to Python newbies, such as calling another program from within your Python script, and generating random silly sentences.

Note that it also uses the new style of string formatting so you will need at least Python version 2.6.

#! /usr/bin/python

import subprocess
import random

def say(sentence):
    speed = "-s " + str(random.randrange(120, 200))
    pitch = "-p " + str(random.randrange(100))
    subprocess.call(["espeak", speed, pitch, sentence])

sentences = [
    "Hello {name}.",
    "{name}? What a {adjective} name!",
    "Congratulations, {name}! You have won a {noun}!",
    "Excuse me {name}. Have you seen my {adjective} {noun}?",
    "Hello {name}. Are you going to Wellington Zoo soon {name}?",
    "What is your name {name}? Oh, that's right, silly me. Your name is {name}!",
    "{name}! Your {adjective} {noun} is {verb}ing! {adverb} grab a {noun2}, {name}!",
    "What is your favourite {noun}, {name}? Is it the {adjective} one?",
    "Quickly quickly {name}! No and Yes!",
    "Where's your mummy {name}? Is she {verb}ing today?",
    "That's what I said {name}",
    "What are you doing {name}? Are you {adverb} {verb}ing? Do you think that's a good idea?",
    "{noun}s are fun. Don't you think so {name}?",
    "Red alert. We go beserk. No {name} moves, no {name} gets hurt.",
    "Please {name}. May we go to the {noun} shop?",
    "Happy birthday to you. Happy Birthday to you."
    " Happy birthday dear {name}. Happy birthday to you!",
    "This is a shout out to {name}. Keep it real homey.",
    "Last night I had the strangest dream. {name} was {adverb} riding on "
    "a {adjective} {noun}, being chased by a thousand {adjective2} {noun2}s. "
    "Luckily, the {noun} was just too {adjective} for the {noun2}",
    "{name} is a good reader!",
    "Time for bed {name}. Go on... off you go!",
    "Make me a {noun} {name}, as fast as you can! I would like a {adjective} one please!",
    "Who ate all of my cake? {name}, was it you?",
    "I'm lost {name}! Can you tell me where I am?",
    "Do you like the circus {name}?",
    "This is the {adjective}est {noun} that I have ever seen. It is even more {adjective} than "
    "that {noun2} that I saw yesterday. Although, to be honest, that {noun2} "
    "was probably more {adjective2} than {adjective}",
    "I just saw a {adjective} {noun} {adverb} {verb}ing a {adjective2} {noun2}.",
    "Never let a {noun} {verb} more than once a day, otherwise it may {adverb} turn "
    "into a {noun2}",

    ]

nouns = [
    "pony",
    "horse",
    "cheesecake",
    "muffin",
    "dragon",
    "car",
    "DVD",
    "Computer",
    "Rollercoaster",
    "Hamburger",
    "Chestnut Park",
    "Cat",
    "dog",
    "TV",
    "soccer ball",
    "sandwich",
    "X box",
    "house",
    "bus",
    "van",
    ]

adjectives = [
    "silly",
    "fast",
    "brown",
    "pink",
    "yellow",
    "blue",
    "purple",
    "golden",
    "funky",
    "red",
    "bouncy",
    "pretend",
    "angry",
    "madd",
    "sadd",
    "badd",
    "grumpy",
    "stupid",
    "awesome",
    "ridiculous",
    "dubious",
    "dodgy",
    "flightless",
    "sleepy",
    "antogonistic",
    ]

verbs = [
    "talk",
    "ignore",
    "runn",
    "grump",
    "riyd",
    "gallop",
    "program",
    "slide",
    "gasp",
    "shout",
    "jump",
    "read",
    "play"
    "dodge",
    "crawl",
    "whisper",
    "hiyd",
    "smell",
    "sink",
    ]

adverbs = [
    "quickly",
    "suddenly",
    "slowly",
    "agrily",
    "Greedily",
    "happily",
    "mostly",
    "rapidly",
    "forcefully",
    "woodenly",
    "passionately",
    ]

n = ""
while True:
    n = raw_input("What is your name? ")
    if not n: break
    #[say(word) for word in random.choice(sentences).format(name=n).split()]
    for i in range(3):
        say(random.choice(sentences).format(name=n,
                                            noun = random.choice(nouns),
                                            noun2 = random.choice(nouns),
                                            verb = random.choice(verbs),
                                            adverb = random.choice(adverbs),
                                            adjective = random.choice(adjectives),
                                            adjective2 = random.choice(adjectives),
                                            ))

 

Making a rogue-like game with libtcod

February 2, 2010 2 comments

Well I haven’t yet made a roguelike game, but I have completed a short tutorial on using the libtcod library.

Trapped in a lonely dungeon. Wait... who's that?!

Libtcod is a library with wrappers available for numerous programming languages which aids in the creation of roguelike games. I happen to be using the Python wrapper.

It provides a special true-colour console with plenty of neat tricks like customizable fonts, blitting of images and off screen drawing areas. These provide the potential for some stunning visuals that still have a blocky, old-school, feel.

While I’m sure these facts alone would make it useful for a great many styles of game, libtcod also provides numerous helpful toolkits which, for the most part, are aimed at roguelike developers.

Basically all of the standard routines that you would otherwise need to figure out for yourself before you can start designing your unique game. These include:

  • Field of view toolkit. What can you see in the dungeon… where does your torchlight fall?
  • Path finding toolkit. Compute the path from A to Z in your dungeon.
  • Keyboard and mouse support
  • BSP dungeon generation toolkit. Tweak the parameters for dungeons, towns, forests or whatever.

Plus a few more neat features you may not have ever imagined you would need for a roguelike:

  • BMP and PNG support
  • Heightmap toolkit 8-O
  • Perlin noise support. Hmmm… ocean anyone?
  • Random number and compression toolkits

It’s probably important to note that you can use any or all of the toolkits that you choose… If you would prefer to implement your own dungeon generator for example, that’s fine too. In fact there is still plenty of work still to be done as a game developer. For instance, libtcod won’t implement the monster AI or combat for you (yet).

Lately I’ve been focusing on learning C++, and if I’m to learn one new language a year (which seems a reasonable goal) then this is certainly the year of C++. However, I would also like to have fun with a language that I already know well (ie. Python), and this is where I see libtcod fitting in. My verdict so far is that I like this library and I think I could have a lot of fun tinkering with it.

I’ll post my game here when it’s awesome :-D

Crikey, I nearly forgot! The tutorial that I was blathering on about at the top of this post is here. At the time of writing this only the first part has been written, but that is enough to create the explorable dungeon level seen in the screenshot above. Here’s hoping that the authors finish the remainder of the tutorial sometime soon.

Painting a radish

January 28, 2010 4 comments
radish

Radish painting

Apart from coding, I sometimes do paintings.

I now present, for your viewing pleasure, the worldwide debut of my new painting, the one with the radish in it.

Categories: Art Tags: , , ,
Follow

Get every new post delivered to your Inbox.