# LS Basic

**LS Basic** or **Letter-Sum Basic** is a simplified dialect of BASIC written by User:Simplemaker which operates entirely on the sums of the values of the letters of each command. This leads to a reasonably easy-to-use language which can be heavily obfuscated, because many words have the same *score*.

## Contents

## Score System

The scoring system is an essential part of LS Basic. Letters are assigned a value, starting with a = 1, b = 2, c = 3, ... This means commands such as

are completely equivalent to words with the same score, such as

Nurse

Both of these have a score of 77. Scores ignore non-alphabetic characters as well as letter case. Before any program is executed, every word in the program is evaluated according to the scoring algorithm, and the resulting list of scores is interpreted and executed. This means commands, labels, variables, and constants all have many synonymous words.

## Input and Output

There are two methods of output. The command

and all words with equivalent score will print a variables value as a decimal.

PrintChar

will print the ASCII character which represents a variable's value.

There is only one class of input command

Input

Which stores a decimal input from the user into a variable.

## Cat Program

### Standard Version

Input Apple Print Apple

### Equivalent Obfuscated Version

Smaller disco muses diner

Note how the obfuscated code does not have a newline. Newlines are ignored; all programs can be rewritten without them.

## Goto and Lbl

In traditional basic, jumps are usually determined either by a line number system or a label system, and LS Basic follows the latter.

lbl loop

creates a label called "loop"

goto loop

would make the program go to the corresponding label. However,

goto two

would also send execution to the label "loop," because two and loop have the same *score*. If multiple labels are declared with the same score, only the top one will be used.

## If Statements

If statements take the form

IfvarAconditionvarBlabel

Where varA and varB are variables, and condition is either *lesser*, *equal*, or *greater*. If the conditional test is true, the program execution moves to the given label. Otherwise, execution continues onto the next line.

## End

End

will halt program execution.

## Truth Machine

### Standard Version

input apple if apple equal one loop if apple equal zero null end lbl null print zero end lbl loop print one goto loop

### Obfuscated Version

snowed shard alb coined term bended unaided if fork takes hopped dogeared fob foe vigil stacker bulkhead gig dim biotic hammers damp oceans drive

## Predefined Variables

In LS Basic, the variables *zero*, *one*, and *ten* are preloaded with their corresponding values. They can be reassigned, and are the only usable constants for constructing other numbers. Other values can be constructed using arithmetic operations.

## Arithmetic

Arithmetic is achieved through the let command. The let command allows for reverse-polish notation manipulation of variables.

let two equal one one plus done

This defines two as "1 1 +" which in infix notation is "1+1", or 2. Let statements must always end with "done," because newlines are ignored. Valid arithmetic operators include plus, minus, times, divide, and mod.

## Hello World

The following prints "HI WORLD!"

let two equal one one plus done let base equal ten two two two times times times ten minus done let letter equal base two plus done printchar letter let letter equal letter one plus done printchar letter let space equal two two times two times two times two times done printchar space let letter equal base ten two times plus two minus one minus done printchar letter let letter equal base ten plus one minus done printchar letter let letter equal base ten plus two plus done printchar letter let letter equal letter two one plus two times minus done printchar letter let letter equal base two minus done printchar letter let letter equal space one plus done printchar letter

It is likely that more efficient methods exist.