Tao of the Machine

Programming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.

Designing a card game (6)

So far, the card game (which is still nameless, by the way), is coming along reasonably well. Although I haven't designed any actual cards yet, everything is still in the rules design phase.

One thing that bugs me about the current setup is that players will most likely end up with lots of creatures in play. This will make the game sluggish, unnecessarily complex and difficult to understand.

One way to prevent this is to limit the number of creatures that can be in play at one time. I'm thinking about a Pokemon-like "bench", but different. The first creature that comes into play will automatically take position #1, the next one #2, etc. If a creature leaves play, the ones "after" it move up one position. (This is easier to do than it seems, all you have to do is put the creatures in a row, and it will become obvious.)

This "bench" would have a maximum size (5, 6, 7?), which restricts the number of creatures in play. Some rules will have to be added: Can you arbitrarily remove creatures from the bench, so there is room for others? Is the position on the bench relevant? Once you have a bench full of creatures that you like, is drawing cards still useful?

Also important is how this "bench" thing will be explained in flavor. Right now, it's just an artificial restriction. In the Pokemon CCG, it is not (there is one "active" Pokemon, others are "waiting" to replace it; the cartoon and game reflect this, so it does not feel awkward in the CCG).

In a fantasy/magic setting, it could be explained by stating that the player (the "wizard") can only maintain a certain number of creatures, much like there is a limit to the number of subordinates that a manager can handle, or to the KLOC that a programmer can handle, etc.

Of course, extra rules also add extra opportunities for cards. What about creatures that increase/decrease the maximum bench size? Creatures that affect their neighbors on the bench (in good or bad ways)? Creatures that effect the opponent's creature on the same bench position? Creatures that affect the way you add/remove creatures to/from the bench? Etc.

Posted by Hans Nowak on 2004-02-06 19:56:05   {link} (see old comments)
Categories: CCGs

More C

Another lesson... behold the dreaded -mno-cygwin switch.

Yes, lately I've been busy trying to compile C code. Existing (open source) packages, sometimes with Python extension modules already written, sometimes not. Windows isn't exactly an ideal platform for this, but something's got to give. If the end result works (i.e. a working .pyd file that can be imported from Python without crashing ;-), then it can be very gratifying. But until that moment is reached, I feel much like I'm stumbling around in a dark room, not really knowing what I'm doing or what's ahead, running into lots of things, sometimes grabbing the right library or using the right switch by accident.

Posted by Hans Nowak on 2004-02-05 23:49:58   {link} (see old comments)
Categories: programming

Firedrop supports Atom 0.3

...so this weblog now has an Atom feed as well. See the sidebar. It actually validates... for now. emoticon:smile

[updated Firedrop build notes]

Posted by Hans Nowak on 2004-02-04 20:18:10   {link} (see old comments)
Categories: Firedrop

Compiling 101

A lesson learned in compiling C code... Just because the configure script and makefiles work, doesn't mean they're up to snuff. Sometimes you just have to throw them away and compile by hand.

Also, don't expect the (third-party) code you're compiling to be without errors or up-to-date.

Basic rules, but easily forgotten when you haven't compiled C code in a while.

Posted by Hans Nowak on 2004-02-04 00:41:00   {link} (see old comments)
Categories: programming

It's just one of those days...

It seems all I do lately is trying to pound unwilling programs into submission, with little success. Java programs that I have no clue how to start or what they require to run. C libraries that won't compile. Or Python extension modules that do compile, but don't actually work.

Maybe I have more luck tomorrow. If nothing else, I learned that compiling Python extensions with Cygwin (or MinGW) is not a walk in the park. :-/

Posted by Hans Nowak on 2004-02-02 23:55:58   {link} (see old comments)
Categories: Python, programming

My RSS does not validate

...again. (Apparently people actually press that button. :-) Culprits are HTML entities like ° and ü and such. I'm pretty sure this post will only add to the problem.

RSS aggregators don't seem to have a problem with it, but the feed validator does. Dumb questions:

1. Why aren't characters like ° allowed? (The answer would probably be something like, "Because an RSS file is XML and not HTML, you moron." Or maybe, "Use something better than RSS 0.91, you doofus.")

2. What would be a good way to deal with these? Should I convert them to something? If so, to what? Update: I wrapped CDATA around the descriptions, that seems to solve it. At least the validator is happy now. ^_^

In related news, I also plan to add an Atom feed to Firedrop. When I have time. I'm currently a bit busy. (Doing what? Hacking Python code, studying Groovy and Swing, trying to make uncooperative Java software work, compiling Python extensions with MinGW, writing SWIG files, etc. All this is work, not personal projects, otherwise the list would include hacking on Firedrop.)

Posted by Hans Nowak on 2004-02-01 11:17:18   {link} (see old comments)
Categories: general

Programming and creativity (2)

Hmm, interesting points were raised in the comments to yesterday's post. A few comments of my own:

Bob Ippolito: "Languages like C and Pascal don't really do less than a language like Python (because you can write Python in C).. they just make you type more. I don't think it's creative at all, just redundant."

Yes, but let's say we're tackling a high-level problem in C (or Pascal, etc). Say, writing a library for XML parsing. Assuming that I cannot or don't want to use third-party libraries, most likely I will have to write my own linked lists, dictionaries, etc. This is a form of creativity, since I'm making something that wasn't there before and is useful. When you only know C, this may indeed be the case. But when you know a high-level language like Python, all that work seems redundant, and not creative whatsoever. In fact, in Python this problem wouldn't come up at all, because you would just use the built-in list and dict.

John Eikenberry: "When I think of restrictive programming languages I think of things like recursion being the only loop construct and no state variables. In my experience languages like Prolog, Scheme or Haskell can force you to be creative. Whereas other standard imperative like Java just make you be more verbose (as compared to Python)."

This is a good point, and it illustrates why learning these languages is worthwile, even if you don't actually use them for real world programming projects. A language with recursion but no loops, for example, forces you to tackle problems differently, and to *think* about them differently. Hence ESR's claim that learning Lisp makes you a better programmer, even if you don't use it. This kind of creative learning is useful even (or maybe especially) if you use other languages.

This is one of the reasons why I keep looking at different languages... not to replace Python (which is my current language of choice), but to learn different concepts. In that respect, Self is interesting, and so are Forth and Logo, to name a few. And even obscure languages like Q-BAL.

Posted by Hans Nowak on 2004-02-01 11:01:33   {link} (see old comments)
Categories: programming

Programming and creativity

Some thoughts:

1. Restrictions don't hamper creativity... they stimulate it.

2. But how do restrictive programming languages (e.g. statically typed) fit into this picture?

Would programming in Java or Pascal be more creative than programming in Python? It certainly doesn't *feel* like it... the restrictive languages get in my way, Python does not.

But in a certain way, yes -- Java and Pascal force me to find creative solutions for things that are no-brainers in Python. Most design patterns, for example. Or iterating over a list with values of arbitrary types. Unfortunately, this introduces creativity where I don't want it... solving a problem is one thing, working around the restrictions that a language imposes on you is another. So this seems like a waste of time, especially since the end result isn't any better or more interesting.

Strange. In art, restrictions fuel creativity, because it forces you to think in ways you haven't thought before. The type of restriction hardly matters -- try making a decent-looking painting with only yellow and blue, or writing a story without using the letter 'e'. Exercises like these will reshape the way you think about painting, writing, etc.

Why doesn't it work that way with programming? Using Java, Pascal, etc, certainly affect the way one thinks about programming, but is it for the better? Some may think so, but I beg to differ. Using these languages doesn't make me a better programmer, nor do they provide a better end result (everything else being equal). With a dynamic language like Python (or Lisp, etc), I get the job done, it's done faster, it's more flexible and maintainable, more open to change, and on top of that, it's fun.

Now, this is not another "Python is cool and Java sucks" rant. For Python, you can substitute your favorite dynamic/non-restrictive language, ditto for Java/Pascal and restrictive languages. No, what I'm wondering is, why don't restrictive languages fuel creativity? Or do they?

Posted by Hans "Hans is like... way out, man" Nowak on 2004-01-31 12:45:37   {link} (see old comments)
Categories: Python, programming

Generated by Firedrop2.