Playing With llor.nu

A fun online game that I’ve been playing, lately, is llor.nu (unroll, backwards). It’s written using Ruby on Rails, has lots of nice Javscript/AJAXy things, and is Open Source.

The game, in and of itself, is rather simple – you roll the dice, collect money, pay rent, build buildings, and get more money. Which can be rather tedious – however, being a programmer, I saw an opprotunity to automate a bunch of the tedium and maximize my profits – and according to the discussion boards, I’m not alone. Recently, the game had an overhaul changing much of the dynamics, and much of my code. One of the things on the developer’s ‘to-do’ list is to implement a public API, but until then, I’ve pulled together a number of commands (e.g. REST-like URL and parameter combos) that can get the job done. So, if you’re interested in writing your own bot, it’s definitely a good place to start.

Logging In

POST /login
user[login]=USERNAME&user[password]=PASSWORD

This is the essential first step of any bot – logging in to your account. The username and password are the ones that you signed up with originally.

Rolling The Dice

GET /js/take_turn/

The most simple of bots can do nothing but login and then roll the dice to kingdom come – under the current version of the game, it is very likely that you will become quite rich.

Buying A Building

GET /deeds/buy/NUM?levels=LEVELS

The next step, is to generate some form of perpetual income (from other hapless players, rolling their dice) – this can be done by buying an available plot and hoping that it’ll be landed on. However, you must first know if you’ve landed on a plot that can be purchased – the easiest way to do this is to take the output from ‘Rolling The Dice’ and to check and see if it contains the text “buy and build”. Some psuedo code:

login();
while( 1 ) {
  data = GET('http://llor.nu/js/take_turn/');
  if ( data.contains( 'buy and build' ) ) {
     GET('http://llor.nu/deeds/buy/2?levels=1');
  }
}

The next important step is to determine what type of building and how many levels to buy – There are four types of buildings numbered 2 (lowest worth), 3, 4, 5 (highest) – and multiple levels (1 to 30ish). You’ll probably want to focus on buying on particular type of building, exclusively – it’ll make your code, and management, much simpler.

That should be sufficient to get you started hacking around – just make sure that you don’t call their poor server too frequently – leave a couple second delay it, to be nice. (Otherwise there may not be any more game to mess with.) If there’s interest, I’ll be happy to delve into the following:

  • Using ducks, Figuring out when to use a duck
  • Using hard hats, Figuring out when to use a hard hat
  • Figuring out how much money you have
  • Renaming Buildings
  • Upgrading Buildings
  • and Selling Buildings

At the very least, be sure to check out the game, it’s very slick, to say the least (and look for me up on the high score board!).

Update: The ‘can I buy’ text has been changed to ‘buy and build’ (to work with today’s update).

Posted: December 16th, 2005


Subscribe for email updates

13 Comments (Show Comments)



Comments are closed.
Comments are automatically turned off two weeks after the original post. If you have a question concerning the content of this post, please feel free to contact me.


Secrets of the JavaScript Ninja

Secrets of the JS Ninja

Secret techniques of top JavaScript programmers. Published by Manning.

John Resig Twitter Updates

@jeresig / Mastodon

Infrequent, short, updates and links.