Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
/ rant3 Public archive

Commit

Permalink
Merge pull request #72 from TheBerkin/dev
Browse files Browse the repository at this point in the history
Rant 2.0
  • Loading branch information
TheBerkin committed Jun 29, 2015
2 parents 81ce6c1 + cf9e977 commit ca68f65
Show file tree
Hide file tree
Showing 262 changed files with 15,979 additions and 6,582 deletions.
74 changes: 74 additions & 0 deletions CmdLine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace Rant.Common
{
internal static class CmdLine
{
private static readonly Dictionary<string, string> Arguments = new Dictionary<string, string>();
private static readonly HashSet<string> Flags = new HashSet<string>();
private static readonly List<string> Paths = new List<String>();

/// <summary>
/// Determines whether the user specified a question mark as the argument.
/// </summary>
public static readonly bool Help;

static CmdLine()
{
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
int argc = args.Length;
if (argc == 0) return;

if (argc == 1 && args[0] == "?")
{
Help = true;
return;
}

bool isProperty = false;

for (int i = 0; i < args.Length; i++)
{
if (isProperty)
{
Arguments[args[i - 1].TrimStart('-')] = args[i];
isProperty = false;
}
else if (args[i].StartsWith("--"))
{
Flags.Add(args[i].TrimStart('-'));
}
else if (args[i].StartsWith("-"))
{
isProperty = true;
}
else
{
Paths.Add(args[i]);
}
}
}

public static string[] GetPaths() => Paths.ToArray();

public static string Property(string name)
{
string arg;
if (!Arguments.TryGetValue(name.ToLower(), out arg))
{
arg = "";
}
return arg;
}

public static string Property(string name, string defaultValue)
{
string arg;
return !Arguments.TryGetValue(name.ToLower(), out arg) ? defaultValue : arg;
}

public static bool Flag(string name) => Flags.Contains(name);
}
}
107 changes: 69 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,110 @@
[![Build status](https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a?svg=true)](https://ci.appveyor.com/project/TheBerkin/rant)
<p align="center">
<img src="http://i.imgur.com/QB3TNYq.png" alt="Rant logo"></img>
</p>

<p align="center">
<img src="http://i.imgur.com/EZinvT5.png" alt="Rant logo"></img>
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/master/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/master?svg=true&passingText=Master%20Build%20Passing&pendingText=Master%20Build%20Pending&failingText=Master%20Build%20Failing" alt="Build status">
</img>
</a>
<a href="https://ci.appveyor.com/project/TheBerkin/rant/branch/dev/artifacts">
<img src="https://ci.appveyor.com/api/projects/status/2vn0imlns20n739a/branch/dev?svg=true&passingText=Dev%20Build%20Passing&pendingText=Dev%20Build%20Pending&failingText=Dev%20Build%20Is%20Kill" alt="Build status">
</img>
</a>
</p>

##What is Rant?

Rant is a language for adding rich variations to text. It combines a markup language with functional and imperative programming concepts to deliver a concise but powerful tool for procedurally generating text. The goal of Rant is to augment human creativity with the boundless potential of randomness, enabling content producers to consider their next idea as not just a concept, but a seed for countless possibilities.
Rant is a language for procedurally generating text. It combines a markup language with functional and imperative programming concepts to deliver a concise but powerful tool for adding rich variations to your text. The ultimate goal of Rant is to augment human creativity with the boundless potential of randomness, helping content producers consider their next ideas as not just static concepts, but seeds of countless possibilities.

###Features
Some of the highlights of what Rant offers:
##Features of Rant

* Recursive, branching choices with various selection strategies (random, ordered, locked...)
* Access to external dictionaries using queries
* Word rhyming using pronunciation metadata
* Synchronize sections of random output
* Automatic capitalization
* Indefinite article (a/an) automation
* Multiple outputs (channels)
* Recursive, weighted branching with customizable selection strategies
* Dictionary queries
* Automation for capitalization, rhyming, and indefinite articles
* Multiple output support
* Richard, an experimental embedded scripting language
* Probability modifiers
* Overwriting (targets)
* Looping (repeaters)
* Conditionals
* List objects
* Subroutines
* Arithmetic
* *And much, much more...*
* Loops, conditionals, and subroutines
* Package loader for easy resource management
* Unmanaged function exports for use in C/C++ applications *(Windows only, sorry!)*
* Compatible with Unity
* **And a whole lot more!**

##Examples

**Generate random sentence**
**Fill in the blanks**
```
<name-male> likes to <verb-transitive> <noun.plural> with <pron.poss-male> pet <noun-animal> on <timenoun.plural-dayofweek>.
```
```
Alick likes to mount shuttlecocks with his pet bat on Mondays.
```

**Generate ten random numbers between 1 and 50 and spell them out using US spelling conventions**
---

**Generate ten random numbers between 1 and 50 and spell them out**
```
[numfmt:verbal-en][rep:10][sep:,\s]{[num:1;50]}
[case:sentence][numfmt:verbal-en][rep:10][sep:\s]{[num:1;50].}
```
```
thirteen, twenty two, thirteen, nineteen, thirty one, thirty four, forty two, twenty six, twelve, forty four
Four. Ten. Thirteen. Fifteen. Eighteen. Twenty four. Seven. Forty eight. Nineteen. Twenty five.
```

---

**Generate 32 random hexadecimal digits grouped into sets of eight**
**Write a poem**
```
[rep:4][sep:\s]{\8,x}
Alternatively...
[rep:32]{\x[notlast:[nth:8;0;\s]]}
[rhyme:perfect]
The <noun(1)::&a> <verb.ed(1)-transitive::&a> the <adj::&a> <noun(1)::&a>.
```
```
6fb34d31 42e27a48 5884bce5 bf743ec8
The bread fed the red head.
```
```
The drug dug the smug plug.
```

---

**Insert text into existing output**
**?????**
```
The following word is [get:N] characters long: \"[mark:a]<noun-animal|fruit>[mark:b]\"
[send:N;[dist:a;b]]
[rs:16;\N]
{
[r:50]{([rr])\u2593|([re])\s}
}
```
```
The following word is 7 characters long: "kumquat"
▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓▓ ▓ ▓
▓▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓▓▓▓ ▓▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓▓
▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓ ▓ ▓ ▓▓
▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓▓ ▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓
▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓
▓▓▓▓▓▓▓▓▓▓ ▓ ▓ ▓▓ ▓ ▓▓▓▓▓▓▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓▓▓▓ ▓ ▓▓
▓▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓ ▓
▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓ ▓ ▓▓▓ ▓
```


##NuGet
Rant is also available as a [NuGet package](https://www.nuget.org/packages/Rant/). Punch the following into your package manager console and smash the Enter key enthusiastically to get it:
```
PM> Install-Package Rant
```
Or if development builds are your thing:
```
PM> Install-Package Rant -Pre
```

But remember, the latest version will always be available on the repository first.

##License
Rant is provided under [The MIT License](https://github.com/TheBerkin/Rant/blob/master/LICENSE).
Expand All @@ -95,8 +125,9 @@ We have a [Trello board](https://trello.com/b/NnvgqGha/rant) where we also track
##Learn Rant
See [rantlang.github.io](http://rantlang.github.io) for full documentation of the API and Rant language, as well as additional example code.

##Try Rant
Want to try Rant before you download anything? Check out [RantBox](http://rant.berkin.me/), an online pattern interpreter I made.
##Other projects
If you like Rant, you may also like these other, Rant-related projects:
* [**RIDE**](http://github.com/RantLang/RIDE): The official (and highly WIP) Rant IDE
* [**Rantionary**](http://github.com/TheBerkin/Rantionary): The official Rant dictionary

##Support Rant
Rant is free to use; however, developing it takes a lot of time and dedication, and things like hosting and software cost money. If you feel so inclined, you may support the project by donating through **[Gratipay](https://gratipay.com/TheBerkin/)**. Any amount is appreciated :)
:squirrel:
39 changes: 0 additions & 39 deletions Rant.Console/CmdLine.cs

This file was deleted.

Loading

0 comments on commit ca68f65

Please sign in to comment.