Johnny's Software Saloon

Weblog where I discuss things that really interest me. Things like Java software development, Ruby, Ruby on Rails, Macintosh software, Cocoa, Eclipse IDE, OOP, content management, XML technologies, CSS and XSLT document styling, artificial intelligence, standard document formats, and cool non-computing technologies.

My Photo
Name:
Location: Germantown, Maryland, United States

I like writing software, listening to music (mostly country and rock but a little of everything), walking around outside, reading (when I have the time), relaxing in front of my TV watching my TiVo, playing with my cat, and riding around in my hybrid gas/electric car.

Wednesday, January 11, 2006

No longer a newbie on Ruby

Last month I taught myself the Ruby programming language.

I have written an object-oriented adventure game. If that genre does not ring a bell, you might be more familiar with the term RPG: role-playing game.

Object-oriented languages are very well-suited to writing RPGs. The original object-oriented programming language, Simula, was invented to do simulations.

An RPG has a bunch of types of objects in it: rooms, weapons, treasure, monsters, players, and so on. Modeling the objects in the game using objects in the program just works very, very well.

The advantage of this particular exercise is that it forces you to use all of the object-oriented and data structure building/manipulating features of a programming language. It also forces you to do input, output, and string processing.

So I really recommend trying this when you are trying to learn a new language and that language supports classes and things.

I have already started writing a chess program in Ruby. A neighbor of mine, Mark, taught me the game before either of us learned to read. I played it quite a bit in grade school and less and less as I got older. Still, the rules are pretty simple and there are only 6 different pieces.

Like RPGs, I read articles on how to program a chess game back in my teens or early twenties. So I expect getting a computer to play chess will not be that difficult for me. I am not really aiming to have the computer win, just play by the rules. I usually lose to computers, so if I beat it - I will actually find that more satisfying, personally. :-D

0 Comments:

Post a Comment

<< Home

Related pages & news