Coder Social home page Coder Social logo

efexgee / fantasyname Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skeeto/fantasyname

0.0 2.0 0.0 99 KB

Fantasy name generator

Home Page: http://nullprogram.com/fantasyname/

License: The Unlicense

Makefile 0.60% C++ 24.64% C 30.29% Python 5.47% Emacs Lisp 4.39% HTML 4.41% JavaScript 19.85% CSS 1.76% Perl 8.61%

fantasyname's Introduction

Fantasy Name Generator

Four implementations -- JavaScript, C++, Elisp, and Perl -- of the name generator described at RinkWorks. The JavaScript and C++ implementations are by far the most mature.

JavaScript

The JavaScript version uses an optimizing template-compiler to create an efficient generator object.

var generator = NameGen.compile("sV'i");
generator.toString();  // => "entheu'loaf"
generator.toString();  // => "honi'munch"

C++

The C++ version also uses a template-compiler (based on the one for JavaScript) to create an efficient generator object. It requires C++11.

NameGen::Generator generator("sV'i");
generator.toString();  // => "drai'sneeze"
generator.toString();  // => "ardou'bumble"

C

The C version generates names directly from the template in a single pass:

char name[64];
unsigned long seed = 0xb9584b61UL;
namegen(name, sizeof(name), "sV'i", &seed);

This is the fastest implementation.

Emacs Lisp

The Emacs Lisp version doesn't include a parser. It operates on s-expressions.

(fset 'generator (apply-partially #'namegen '(s V "'" i)))
(generator)  ; => "essei'knocker"
(generator)  ; => "tiaoe'nit"

Perl

The Perl version is exceptionally slow, due to a slow parser.

generate("sV'i");  # => "echoi'bum"

This is the slowest implementation.

fantasyname's People

Contributors

1hyena avatar darvin avatar kronuz avatar skeeto avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.