Skip to content

Instantly share code, notes, and snippets.

/*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*/
#include "UTF8.h"
#include "Unicode.h"

class RandomNumberGenerator

A minimal & cheap generator for pseudo-random numbers.

Constructors

These all set the seed to the specified parameters.

RandomNumberGenerator(unsigned int seed = unsigned(std::time(0)));  // Derive the 64-Bit seed from a 32-Bit seed. If no seed is given use the system time as seed.
RandomNumberGenerator(unsigned int lowSeed, unsigned int highSeed);
Rule
{
Chance = 1
Priority = 1011
PatternCenter = [1, 0]
OutputCenter = [0, 1]
[->Pattern]
ww
ww
[
{
Name: Strategist
Tags: ["Tactican"]
Effects:
[{
Attributes:["Tactics", 2]
}]
},
@API-Beast
API-Beast / new.cpp
Last active August 29, 2015 14:07
New ModC Configuration.
ScriptManager modc;
// Environment and Configuration can still be modified by accessing the public member variables in modc.
modc.compileAndLinkFile("script.modc");
VirtualMachine vm = modc.prepareVM();
vm.callFunction("Main");
@API-Beast
API-Beast / gist:7e1ad1ab5fec1841c4ff
Created October 6, 2014 14:25
ModC Configuration
// The basic profile of the language
// One could for example add additional operators by modifiying it.
Config config = BaseConfiguration();
// The script envionment, e.g. which variables/functions are defined?
// This is seperate because so we can link different script fragments together.
Environment env;
// The parser, it only needs to know about the configuration.
Parser parser = Parser(&config);
for(string script : scripts)
@API-Beast
API-Beast / gist:928cef251680d7341a10
Last active August 29, 2015 14:03
Short XINI format description

Example

Settings
{
  Name=John
  FavMaps=[Intro, "The Final Battle"]

  [Video]
  Resolution=500x800
 Bitdepth=32
@API-Beast
API-Beast / AVec3.h
Last active August 29, 2015 13:57
Markdown extraction from source code for reference documentation.
// = Vec3
// T is the Type of the Vec3
template<typename T>
struct Vec3
{
//~ == Member accessors
union
{
struct
{
@API-Beast
API-Beast / Components.cpp
Last active December 28, 2015 09:59
Component-Entity system.
#include <map>
#include <typeinfo>
#include <set>
typedef size_t EntityID;
struct BaseComponent
{
virtual ~BaseComponent(){};
EntityID BelongsTo;
};