Archive for the ‘writing’ Category

Out with the old

So it’s bye bye to, my five year old blog on interesting things. I’m not sure what will happen as I’ve sold it, the domain name and the twitter hashtag.

New in is fiction writing, an experimental fiction writing site for me to play and practise and gratis which is about free things. Software currently but this will probably change. – Any questions?

Continuing in a very creative mood, I’ve today setup Writers Q & A, a website for people to post questions and answers on writing and writers. The intention is to have something similar to the programmers Q & A website, but for writers.

Although I’m a part time technical writer on, I’ve dabbled with fiction (and sci-fi) writing over the years and really want to develop it more; it’s an itch i have to scratch but it’s in my metaphorical back where I can’t reach it. is a small step towards that goal. I figure if I give a little I get a little! So it’s completely free, no ads. It’s an experiment which if it fails costs me very little.

Rock, Scissors and Paper Contest Rock, Scissors and Paper Contest
My other hat is writing the About C, C++ and C# website for– the New York Times owned website. I’m one of their 600 guides who write for them.

One of the interesting things I’ve been doing there is running the Rock, Scissors and Paper (RSP) contest– it’s free and open to anyone and new players can join anytime between now and Christmas. It’s not the easiest to let developers use all three languages to write bots to play RSP but I managed it.

Each week, every bot in the contest plays every other bot in a 100 hand match. All wins are totalled up and that determines the ranking.

What I did was develop a C# Winforms application that uses a dll for each bot. I’ve done the hard bit and provided a full skeleton dll for C, C++ and C# that anyone can download and flesh out; just fill in the function bodies, the move logic goes in the GetMove() function. I wrote a C# wrapper for the C and C++ bots which wraps the dll calls in a class- it looks like this:

   public class bot
      public const int botnum = 1;
      const string dll = “c:\ongoing\dlls\skeleton1.dll”;

      CallingConvention = CallingConvention.Cdecl)]
      public static extern string GetBotName(); // returns name of your Bot

      CallingConvention = CallingConvention.Cdecl,CharSet=CharSet.Ansi)]
      public static extern char
         GetMove([MarshalAs(UnmanagedType.LPStr)]String S,
         [MarshalAs(UnmanagedType.LPStr)]String S2); // return move

.. others trimmed for shortness

Note the marshalling attributes – the dlls use cdecl, it’s ansi chars (8 bit as C# uses Unicode) and the strings are passed as lpstr. A string in C is just an array of 8 bit chars.

This function GetMove passes in the previous hands (in this match against one bot) so you can see what your bot played and what the opponent played. After each week I publish the results and a file containing all bots moves- eg this was the match between bot 1 and 5. 1 won 29 times, 5 won 33. Below this are the strings which I’ve trimmed to fit this.

1 v 5 29 33

You can see the full file this came from: Week 6 results It’s just a text file, generated by the application.

So if you fancy entering- remember it’s free just follow this link:
Rock, Scissors and Paper Contest