Adventures in Clojure: The Fact Base

clojure

When you're writing a game based around a game world of some kind, be it a text adventure like Zork, an action adventure like The Legend of Zelda, or any number of other games, there's stuff your game needs to remember. A lot of it has to do with the player: where is he, how much health does he have, does he have the Iron Mitts of Cooking that let him invade and conquer the Iron Chef Temple of Cuisine?But on top that, there are a lot of just plain facts to remember. Where has he been? … [Read more...]

Quill: A Build System for TCL/TK

Quill

I'm taking a break from posting about Clojure this week, because a few weeks ago my study of Clojure inspired me to work on a non-Clojure project. That sounds odd, I suppose, but it's often the way: in studying some programming language I'm not familiar with, I get ideas for work in areas I am familiar with.In this case the inspiration came from the Leiningen build tool, which I gushed about a couple of months ago. To recap, a budding Clojure programmer need only download Leiningen; and it … [Read more...]

Adventures in Clojure: Nearly Constant Data

clojure

As I noted last week, the Clojure way is to keep immutable (unchanging) data separate from the mutable data. Thus, you keep the network of rooms distinct from the data structure that indicates where the player and other things are at the present time. The latter changes while the game runs, and the former doesn't.At least, that's the theory. As I showed a couple of weeks ago, you can define the world map as a single, immutable data structure, and never change it thereafter. But there are … [Read more...]

Adventures in Clojure: Saving the Day

clojure

See the previous installment here.It's a big part of the philosophy of Clojure programming that you keep mutable state (data that can change) separate from immutable state (data that cannot change). There are a number of good reasons for doing this; the one that the Clojure books usually trot out is that it makes supporting concurrency easier because you don't need to synchronize reads and writes to data that never changes.Concurrency isn't all that important to a single-user text … [Read more...]

Adventures in Clojure: The World is Mine!

clojure

So I'm, in a rather desultory fashion, putting together a simple text adventure in the Clojure programming language. (You can find the code at GitHub, should you be interested.)The first thing you need in a text adventure game is a world to move around in. The world usually consists of a collection of rooms. Each room can have any number of links to other rooms; each link is in a particular direction. Directions include the four cardinal directions (north, south, east, and west) and … [Read more...]

Tools for Learning Clojure, Part V: A Game!

WorldMap

Previous Parts: I, II, III, IV.I've always maintained that the only way to really learn a programming language is to code up some kind of project using it: not something out of a book, but something of my own, something that's fun. For many years, my project of choice was the old fashioned text adventure. I got started with computers in the mid-1970's, when we all we had were dumb-terminals and today's beautifully 3-D rendered games were not even a dream. Text was king; and text adventure … [Read more...]

Tools for Learning Clojure, Part IV: GitHub

GitHub Octocat

In Part I, I talked about Clojure and the need for a convenient "REPL": a piece of software that lets you type input at the language engine and see its responses. In Part II I talked about Leiningen, a very cool tool that not only gives you a good REPL but also automates many other tedious aspects of development. In Part III I talked about a simple IDE for Clojure called Nightcode.And the final piece in the puzzle is GitHub.GitHub is a website that provides configuration management … [Read more...]

Tools for Learning Clojure, Part III: Nightcode

nightcode

In Part I, I talked about Clojure and the need for a convenient "REPL": a piece of software that lets you type input at the language engine and see its responses. In Part II I talked about Leiningen, a very cool tool that not only gives you a good REPL but also automates many other tedious aspects of development. (I find myself wishing very strongly that TCL, my usual language, had something like it.)So at the end of Part II, it looked like I had a solution: Leiningen gives me the REPL and … [Read more...]

Tools for Learning Clojure, Part II: Leiningen

Leiningen

In part I, I talked about Clojure and the need for a convenient "REPL": a piece of software that lets you type input at the language engine and see its responses. And I found one in an usual place: a build tool for Clojure applications and libraries.Bear with me; this is all relevant.For a working software engineer, some kind of build tool is essential. There are lots of repetitive actions involved in making a piece of software ready to run, too many to do by hand every time. A build … [Read more...]


CLOSE | X

HIDE | X