Sunday, 23 August 2015

New update for Have Spell Will Travel #havespell

New updates.
I've updated my #javascript adventure game.  There are improvements to the interface; more quests and locations; a new temple and junk shoppe have opened in the village; cursed items (that cannot be dropped unless you visit the temple first) and loads more encounter too.  I've made a few adjustments to game balance, including the starting attributes for characters.  Most of the paid-for items now cost much less of your hard-earned gold too.

If you want to kill some kobolds, then Have Spell Will Travel is for you.


Sunday, 16 August 2015

Cool stuff I found in my #pocket

If you haven't already discovered pocket, then I do suggest you check it out.  Pocket is a tool for saving articles and web pages for later. When you stumble across something interesting and you want to remember where it is for later, then just put it in your pocket.  There is a useful chrome extension for this and also Windows metro apps like Latermark.

Here are a few cool things I have saved in my pocket.

Interactive Map of Penguins

Interactive Penguin World Map.  Click on the red regions for information about penguins.  Why do polar bears not eat Penguins? They struggle to get the wrappers off.


Create your own custom-made pulp magazine covers.

I really like this.  There are loads of controls, and loads of presets to choose from.Download your finished image when you are done.

This character creator generates random backstory for your role playing or fiction-writing needs.

Loads of other generators available including Basic Appearance generator, backstory generator and outfit generator.  Have fun!

Watch the Moon cross in front of the Earth, as seen from a million miles away

This EPIC gif...

Taken from the Earth Polychromatic Imaging Camera (EPIC), NASA have released a stunning gif showing the Moon crossing in front of the Earth.  That's the seldom-seen 'dark' side of the moon crossing the blue orb of the Earth.

Thursday, 13 August 2015

Have Spell Will Travel #HaveSpell

Introducing my latest game - Have Spell Will Travel - a fast-faced RPG lurking somewhere near where Talisman meets Top Trumps.  Choose from one of a hundred different characters; find treasure and kill kobolds.

The current version has over one hundred different encounters across over thirty different locations.  There are currently twelve quests to complete but more are coming soon.  Can YOU beat Warren Fogbender?  Can YOU restore peace to the village of Merripond?  Find out here.

Use the hashtag #HaveSpell on Twitter to send me love as this will encourage me to continue development of this game.


Tuesday, 11 August 2015

The #truth about #beards


EDIT - that last post regarding the truth about beards inforgraphic did not work very well, so I have moved it.  Follow this link for the new post.

Sunday, 2 August 2015

I made a #JavaScript #English #Dictionary

Introducing my online Oxford English dictionary.  Search for a word and the program finds all words that contain that word.  Furthermore, search within the results: click on any of the words in the definition and you will get a definition for that word, and all words that contain that word (and so on....).  The dictionary keeps track of your previous searches in case you ever need to go back.

Friday, 17 July 2015

Writing a #javascript game 3

So, I have been making slow but steady progress with my Javascript text adventure game.  So far I have implemented quests which can be started at the village.  Each quest is a series of challenges which I have encoded in a json file.  Each challenge script requires the player to pick from a list of statistics in Top Trumps style in an attempt to defeat the challenge.  Failure to beat the challenge results in pain, damage, death or failure of the quest.  Completing a challenge will result in experience points that can be used to increase your stats (not yet implemented).  Completing quests will result in more things becoming unlocked in the village (starting with the village healer and the tavern).  I have also implemented a json file containing a variety of artefacts that can be discovered and used by the player.  Some artefacts are 'static' in that they always apply one or more bonus or penalty to the player's stats.  Non static objects can be activated.  Last night I implemented weapons (the player can only have one weapon at a time) and armour (which can only be worn when the player is not currently engaged in a quest).

I have decided to use Sweet Alert for all the message boxes in the game.  This is because Sweet Alert is really, well, sweet, and also because it is very easy to use.  Below is an image of a Sweet Alert message box in action.

An example of a sweet alert message.
SweetAlert was created by Tristan Edwards, you can follow him on Twitter or Dribbble for updates and other cool projects!

See you next time for more Have Spell Will Travel updates.

Sunday, 12 July 2015

Writing a #javascript game 2

Today I started writing the game data, starting with the stats that describe the player.  In the game of Have Spell Will Travel you take the role of a fantasy character questing through various challenges.  Anyone who played the Unofficial Talisman Game might know what I'm doing here.  Each player is a list of statistics that they use to defeat challenges.  The player chooses a race and a profession.  This combination determines their overall statistics.

Today I wrote some scripts for choosing a combination of race and profession and then providing a character sheet that can be opened and closed with some JavaScript, as in the images below.

Choosing one of the different races.  More coming soon.

Today I have been creating these collapsible stats boxes.  

Friday, 10 July 2015

Writing a #javascript game 1

So, with a little time on my hands and a desire to learn some more Javascript I've been working on a new game.  "Have Spell Will Travel" is a  browser game set in a fantasy Dungeons and Dragons meets Top Trumps/Talisman-esque world.  I will avoid writing too much about the game play for now until there is something to actually play.

My first step was to define the various css box-model elements and make sure they work across all platforms.  Next step was to define some nice styles for the background images, and dialogue boxes.  I have chosen to use styled paragraphs with onclick=() methods rather than hyperlinks for navigation.

The page can be broken down into a heading box, (an initially hidden) status box, and a dialogue box that contains the navigation.

I am rather pleased with the progress so far.  More posts soon...

Wednesday, 1 July 2015

If there was a programming language for Yorkshire

Being a typical Yorkshire lad, I do often struggle with the strict syntax of most modern scripting languages.  The solution is 'Ayup' - a programming language for Yorkshire folk.  It is powerful enough to quickly parse web pages when you are half way up to your neck in mud; need to run a regular expression when lost on Ilkley moor, and is easy enough to write even when you are steaming from an afternoon in the Dog and Ferret in Harrogate.

Starting a script in Ayup requires the shebang line:


This provides a path to your Ayup interpretter.

Writing 'Hello World' to the terminal is as simple as:

wri'aht("Ay up, World!")

It is useful to use a pragma to eliminate unsafe constructs in the dialect.  The following code demonstrates this.

use none o' thy nonsense
wri'aht("Ay up, World!")
cop aye

All scripts in Ayup return 'aye' (true).


Iteration can be performed in a number of ways.  Consider the following code fragments.

Displaying all the elements of a list:

use none o' thy nonsense
fer apiece o'these i' t' (ham):
wri'aht( thi' )
cop aye

Obtaining an iterator from an iterable list:

use none o' thy nonsense
fer peas in (ham):
wri'aht( peas )
cop aye

Repeating until a condition is met:

use none o' thy nonsense
#do something useful
keep buggerin' on until (<condition>)
cop aye


Boolean statements always evaluate as either 'Aye' or 'Nay' in Yorkshire.  Consider:

is (foo > nowt):
wri'aht("eeh by gum")
cop aye

Breaking out of a loop.  You can break out of any iteration simply with the pack it in statement.

use none o' thy nonsense
fer apiece o'these i' t' (ham):
wri'aht( thi' )
is (thi' is "peas"):
pack it in
cop aye

User defined functions

Functions are defined using the keyword mek.  Note the use of exception handling in this example.

use none o' thy nonsense
fram maths impoart random

mek addition( thi' ) wang ValueErrorException:
a = thi' plus t'random.randa(1)
cop a

wri'aht( addition(5) )

That's all for today.  Join us next time when we will look at object-oriented Yorkshire, and global (you're not from round here) variables.

Wednesday, 24 June 2015

#Python Command Line Calculator

Continuing from yesterday's post on the #python cmd command line library, I have written a more complete example.  The command line calculator is a simple program for performing simple calculations in the command line using only python standard libraries.

  • Calculations are entered into the accumulator in the form <operator> <operand>.  For example, to add 3.4 to the accumulator, type "add 3.4".  
  • Supports addition, subtraction, multiplication, division, floor division, modulo, exponential power and reciprocal operations.
  • You can store any value as a variable and use the variables in calculations.  
  • Chain multiple calculations at once.

import cmd
import datetime
import textwrap

class Calc(cmd.Cmd):
    """A Command line calculator"""
    def __init__(self):
        cmd.Cmd.prompt = ""
        self.__acc = 0 #the accumulator
        self.__version = ""
        self.__vars = {}

    def initialise(self):

    def __getVersion(self):
        return self.__version

    def __showKeyError(self, args):
        return ("There is a problem with that variable\n'"+args+"' is not stored.")

    def __showSyntaxError(self, args):
        return ("I'm sorry old boy, there is no such command or variable '"+args+"'!")

    def __showVariableError(self, args):
        return ("Bad variable name '"+args+"'!")

    def __makePrompt(self):
        cmd.Cmd.prompt = "--->"+str(self.getAcc())+"\nEnter command or 'help' : "

    def __setAcc(self, avalue):
        """Sets the accumulator to a value"""
        self.__acc = avalue

    def getAcc(self):
        """get method for the accumulator"""
        return (self.__acc)

    def __setVariable(self, key, value):
        """Add item to dictionary"""
            self.__vars[key] = str(value)
        except NameError:

    def __getVariable(self, key):
        """Returns the value associated with the key"""
        return self.__vars[key]

    def __showAllVars(self):
        for key in self.__vars:
            print ("  "+key+" = "+self.__vars[key], end=", ")
        print ("\n")
    def do_version(self, args):
        """Displays the calculator version number"""
        print("Version: ", self.__getVersion(), end="\n")

    def do_clear(self, args):
        """Clears all variables and sets the accumulator to zero"""

    def __evaluate(self, args, b, op ):
            #Try to add the value onto the accumulator
            a = float(args)
            self.__setAcc( eval(str(b) + op +str( a ) ) )
        except ValueError:
                #Now look for a key in the dictionary
                a = float( self.__getVariable(args) )
                self.__setAcc( eval(str(b))+ op + str( a ) )
            except KeyError:
                print( self.__showKeyError(args) )
    def do_add(self, args):
        """Adds the argument to the accumulator. Example, add 5.3"""
        self.__evaluate( args, self.getAcc(), "+" )

    def do_sub(self, args):
        """Subtracts the argument from the accumulator. Example, sub 5.3"""
        self.__evaluate( args, self.getAcc(), "-" )     

    def do_divide(self, args):
        """Divides the accumulator by the argument. Example, divide 5.3"""
        self.__evaluate( args, self.getAcc(), "/" )    

    def do_multiply(self, args):
        """Multiplies the accumulator by the argument. Example, multiply 5.3"""
        self.__evaluate( args, self.getAcc(), "*" )      

    def do_div(self, args):
        """Performs floor division between the accumulator and the argument.  Example, div 3"""
        self.__evaluate( args, self.getAcc(), "//" )      

    def do_mod(self, args):
        """Performs modulo operation between the accumulator and the argument.  Example, mod 3"""
        self.__evaluate( args, self.getAcc(), "%" )      

    def do_raise(self, args):
        """Raises the value in the accumulator to the power.  Example raise 2"""
        self.__evaluate( args, self.getAcc(), "**" )

    def do_recip(self, args):
        """Find the reciprocal of the vale in the accumulator"""
        self.__setAcc( 1/self.getAcc() )

    def do_store(self, args):
        """Store the value in the accumulator into a named variable.  Exmaple, store x"""
        self.__setVariable(args, str(self.getAcc()) )

    def do_load(self, args):
        """Load a value into the accumulator"""
            #Try to find a value and put it in the accumulator
            a = float(args)
            self.__setAcc( a )
        except ValueError:
                #Now look for a key in the dictionary
                a = float( self.__getVariable(args) )
                self.__setAcc(  a )
            except KeyError:
                print( self.__showKeyError(args) )

    def do_time(self, args):
        """Displays the current time."""
        print( datetime.datetime.strftime((, '%H:%M:%S') )

    def do_date(self, args):
        """Displays the current date."""
        print( datetime.datetime.strftime((, '%Y-%m-%d') )

    def help_me(self):
        msg = "Enter command line calculations (e.g.  add 3.2).  Perform multiple calculations with the 'chain' command (eg chain 4; add 4; div 2).  Assign to a variable with 'store <varname> (e.g. store x).  Clear the accumulator and all variables with 'clear'."
        for x in textwrap.wrap(msg, 50):

    def help_about(self):
        msg = "Command Line Calculator "+self.__getVersion()+" superdecade games. or"
        for x in textwrap.wrap(msg, 50):

    def do_chain(self, args):
        """Execute a series of commands separated y semi colons.  Example: 8; add 3; sub 5"""
        for x in args.split(";"):
    def emptyline(self):
        """deals __makePromptwith empty input line"""
        #print("\nThe accumulator is...", self.getAcc())

    def default(self, args):
        """Overides the default error message"""
            #user types a number so set accumulator to that number
            a = float(args)
            self.__setAcc( a )
        except ValueError:
                #user has types a variable so set accumulator to that number
                a = float( self.__getVariable(args) )
                self.__setAcc( a )
            except KeyError:
                print( self.__showSyntaxError(args) )

    def do_show(self, args):
        """See the value of a variable.  Example show x"""
        if args == "":
                #user has types a variable so set accumulator to that number
                a = float( self.__getVariable(args) )
                print("  "+args+" = "+str(a))
            except KeyError:
                print( self.__showSyntaxError(args) )

    def postcmd(self, stop, line):
        """Script that runs when the current command has completed"""
        self.__makePrompt() # remake prompt so it includes the accumulator value
if __name__ == "__main__":
    mycalc = Calc()
    mycalc.cmdloop("Command Line Calculator\n")