Skip to content

An interpreted programming language made for tabletop games

License

Notifications You must be signed in to change notification settings

drownedNonsense/whist-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whist-lang

License: GPL v3

Description

An interpreted programming language prototype made for tabletop games.

Features

  • 16-bit integer arithmetic
  • Dice throw
  • Function definition
  • Register management
  • If statement
  • While statement
  • Comments
  • Debugging
  • Terminal arguments
  • String management
  • Input handling
  • Dice and function distribution

Examples

Terminal arguments

whist-lang.exe read line "tell -> ...;"

whist-lang.exe read file script.ws

Exploding dice

define [EXPLODING_DICE]:
  let [throw] <- 1d6;
  let [sum]   <- integer [throw];

  while | integer [throw] = 6 |:
    set [throw] <- 1d6;
    set [sum]   <- integer [sum] + integer [throw];
  >>>>
  
  out -> integer [sum];
>>>>

tell -> integer [EXPLODING_DICE];

Fibonacci sequence computing

let [n] <- 16;

# A function that computes the fibonacci sequence up to the `n`th value.
define [FIBONACCI]:

  let [a] <- 0;
  let [b] <- 1;
  let [i] <- 0;

  while | integer [i] < integer [n] |:
    tell -> integer [a];
    let [c] <- integer [a] + integer [b];
    set [a] <- integer [b];
    set [b] <- integer [c];
    set [i] <- integer [i] + 1;
  >>>>

  out -> ...;
>>>>


tell -> void [FIBONACCI];

Releases

No releases published

Packages

No packages published

Languages