New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

culture-generator

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

culture-generator

A generator for cultures

  • 0.25.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

Culture Generator

Generates a random Dwarf Fortress Culture.

Installation

npm install --save culture-generator

Usage

Generate Random Culture

import {
  Culture,
  ethics,
  beliefs
} from "culture-generator"

const culture = new Culture(
  { seed: "seed" }
)

console.log(culture.name) // => Enom-Shónsúm
console.log(culture.getEthicDescription(ethics.ASSAULT)) // => is shun
console.log(culture.getBeliefDescription(beliefs.LAW)) // => respects the law

console.log(culture.getEthicsDescription())
//  => [
//       'assault is shun',
//       'eating sapients is unthinkable',
//       'eating sapients that have been killed in battle is a crime punishable by exile',
//       ...
//     ]

console.log(culture.getBeliefsDescription())
// => [
//      'respects the law',
//      "doesn't particularly value loyalty",
//      'does not care about family one way or the other',
//      ...
//    ]

console.log(culture.toString())
// => someone from the Enom-Shónsúm culture has the following beliefs: respect
//    s the law, doesn't particularly value loyalty, does not care about famil
//    y one way or the other...

Generate Culture With Particular Ethics & Beliefs

import {
  Culture,
  ethics,
  beliefs,
  ethicValues,
  beliefValues
} from "culture-generator"

const culture = new Culture(
  {
    seed: "seed",
    ethics: {
      [ethics.ASSAULT]: ethicValues.ACCEPTABLE
    },
    beliefs: {
      [beliefs.LAW]: beliefValues.LOWEST
    }
  }
)

console.log(culture.getEthicDescription(ethics.ASSAULT)) // => is acceptable
console.log(culture.getBeliefDescription(beliefs.LAW)) // => finds the idea of laws abhorrent

Branch Culture

import {
  Culture
} from "culture-generator"

const cultureOne = new Culture(
  { seed: "culture-one" }
)

const branchCulture = cultureOne.branch(1)

const otherCulture = new Culture(
  { seed: "culture-two" }
)

console.log(cultureOne.getOpinion(branchCulture)) // => 22
console.log(branchCulture.getOpinion(cultureOne)) // => 9

console.log(cultureOne.getOpinion(otherCulture)) // -13
console.log(otherCulture.getOpinion(cultureOne)) // -22

console.log(branchCulture.getOpinion(otherCulture)) // -35
console.log(otherCulture.getOpinion(branchCulture)) // -26

Global API

new Culture(props) => Culture

Used to create a new Culture.

PropertyTypeDescription
seedstringSeed used for the randomization of the culture.
ethicsobjectUsed to specify the ethics of the culture.
beliefsobjectUsed to specify the beliefs of the culture.

.name => string

Used to get the Culture's name.

.ethics => Object

Used to get the Culture's configured ethics.

.beliefs => Object

Used to get the Culture's configured beliefs.

.getEthicDescription(ethic:string) => string

Used to get a user friendly description of how an ethic is viewed.

.getEthicsDescription() => string

Used to get a user friendly description of how all the ethics are viewed.

.getBeliefDescription(belief:string) => string

Used to get a user friendly description of how a belief is viewed.

.getBeliefsDescription() => string

Used to get a user friendly description of how all the beliefs are viewed.

.branch([difference:number]) => Culture

Used to create a similar culture.

.getOpinion(otherCulture:Culture)

Used to get the opinion of another culture.

References

  • DF2014:Civilization
  • DF2014:Ethic
  • DF2014:Beliefs

FAQs

Package last updated on 15 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc