Tom Alexander

View Original

13 - Programming Your Killbot

In previous chapters we’ve covered the preparation, assembly and control of your Killbot. In this section, we’ll explore the basic principles of programming and write a simple control script. Programming your Killbot has a number of advantages over manual control, as it allows the Killbot to operate to peak efficiency, leaving you free to deal with other tasks.

If you’ve never used a programming language before, there’s no need to panic - it’s really quite simple. Killbot uses a customised programming language called Murderscript. This is what’s known as a “high-level” language, designed to be easily read and understood by even novice programmers. (Advanced programmers can bypass Murderscript and access the core instruction set directly by using the low-level “M++” language. This is covered in the Advanced Technical Manual). Even if you have some programming experience, it’s a good idea to run through the tutorial to familiarise yourself with the syntax of Murderscript. The following is a basic program that will tell Killbot to kill twelve tall men. The full program looks like this:

// First Killbot Program
//  
// Preparation Phase

new.spree(“tall-men”) {
 flush.emotion;
 exclude.operator;
 total.bodycount = 12;
}

define.range() {
 type.radial;
 distance(500);
}

define.victim(“beanpole”){

var.beanpole(“height”, int);
 var.beanpole(“male”, bool);
 }
// Killing Cycle

travel.range();

scan.target {
IF height >= 190 AND male = true THEN target=beanpole;
ELSE ignore;
}

define.method(decap);

execute.beanpole (bodycount++);

on total.bodycount return;

If this all looks complicated - don’t worry. We’ll go through it line-by-line so you can see exactly what each of these commands mean in real terms.

The first stage of the program is the “preparation phase” where various parameters are established before Killbot goes into action. First off, we need to define the scope of our murder.

new.spree(“tall-men”) {
 flush.emotion;
 exclude.operator;
 total.bodycount=12;
}

This defines a new .spree with the name “tall-men”. If we were just murdering one person, we would use the .murder type, but any murder with more than one victim is considered a .spree. It’s good practice to name your subroutines, as it will allow you to recall them at a later date. If, for example, at a future date you wanted to program Killbot to eliminate tall men and fat women, you would be able to call the “tall-men” .spree from memory, without having to retype the instructions.

As we define the .spree, we also set a few parameters for the program. We use flush.emotion to bypass Killbot’s moral compass and to discriminate purely on the criteria defined within the program. Also, we exclude.operator to make sure that the programmer and operator of the killbot (i.e. you) is not considered a target for Killbot. (!! THIS IS A VERY IMPORTANT STEP - DO NOT OMIT THIS LINE OF CODE, EVEN IF YOU DO NOT MEET THE PARAMETERS LISTED WITHIN THE PROGRAM!! Programmers often test lines of code as they go and omitting the exclude.operator function may result in your death.)

Finally, we will specify a total.bodycount, which in this case is 12 victims. Sprees can have many different parameters that account for success or failure and these are covered in more detail in subsequent chapters. For the moment, though, we’ll stick with a simple parameter that gives us a definite state of completion.

The next step is to define how far and in what manner Killbot should travel in order to find victims. We do this by defining a range of 500 metres from the operating station, going out in a radial direction.

define.range() {
 type.radial;
 distance(500);
}

Unless we define a range, Killbot will continue travelling indefinitely. While this dogged determination is admirable, it’s a good idea to keep Killbot on a leash until you’re more confident in your programming abilities. By keeping Killbot close to home, you can monitor its progress and tweak your programs until they produce the exact results you want.

The final phase of the preparatory stage is defining a .victim. Using Murderscript, we are able to define a set of parameters that will enable Killbot to find victims based on any number of parameters. In this example, we are intending to kill tall men, so we first ascribe them the victim name “beanpole” and then define a few parameters that will enable Killbot to discriminate them from other people. Murderscript has a number of built-in parameters you can call on in order to identify Killbot victims. In this example, we are using “height”, which is an integer (whole number) value and “male” which is a boolean (true or false) value.

define.victim(“beanpole”){
var.beanpole(“height”,int);
var.beanpole(“male”,bool);
}

This completes the first stage of the program and Killbot now has enough parameters to work with. If you wanted, you could add further conditions to the “beanpole” victim type, but for the moment, these two parameters will suffice.

With the parameters set, we now enter the main program loop. This is the basic operating instructions for Killbot “in the field”. First, we tell Killbot to start moving and looking for targets. We do this by using the travel command and tying it to the range we set earlier.

travel.range();

Killbot automatically searches its surroundings for new potential targets and when it finds one the scan mode is automatically triggered. It’s at this point that we need to compare the data of the current target with the parameters we have already defined for our intended victim. This is done by a IFTHENELSE comparison, which gives Killbot a series of parameters to compare the currently scanned object to.

scan.target {
IF height >= 190 AND male = true THEN target=beanpole; 
ELSE ignore;
}

In this case, we state that the scanned object’s height must be greater than or equal to 190cm (Killbot defaults to metric measurements) and must be male (meeting the male=true condition). IF these conditions are met THEN the target is given the label “beanpole” and if it doesn’t meet these requirements, it’s something ELSE and (in this case, at least) it can be ignored. As time goes on, you will learn how multiple IF… THEN… ELSE arguments can discern different kinds of targets and foster a modular approach to Killbot’s murders.

As well as acquiring targets, Killbot also needs to know the best manner in which to  dispose of the target. This can vary depending on the exact configuration of your Killbot, but assuming a basic configuration that is accessible to all models, we will select a parameter appropriate to the target. Given that we are selecting targets for their height, decapitation seems appropriate. We choose this by defining the method of death, like so:

define.method(decap);

So far we have defined Killbot’s range of travel, given it parameters for selecting targets and even chosen the method by which it will murder but as yet we have not given it the command to kill. Without the following command, Killbot will simply store data on the targets it scans. By adding an execute command, we ensure that Killbot fulfils its primary purpose and kills the target at hand.

execute.beanpole (bodycount++);

You’ll notice that as well as the execute command, there’s an additional rider on the command.The use of “++” tells Killbot to increase the value of bodycount by 1. The next line of the program compares the current value of bodycount to its projected total. 

on total.bodycount return;

If the values are equal, the command tells Killbot to return to its operator. Alternatively, we could tell it to explode or commit seppuku, but given that this is our first program it’s probably best to leave those options to one side.

Hopefully this brief example has given you a taste of how much can be accomplished by programming your Killbot for autonomous destruction. In the following chapters, you’ll learn more about how Killbot can acquire, discriminate and destroy targets based upon any number of parameters.

Programming Exercise

Write a program that will kill the following:

  • 8 targets
  • All female
  • Under 140 cm in height
  • Within 800 metres of the operator