{"id":16391105,"url":"https://github.com/queirozfcom/rachinations","last_synced_at":"2025-03-21T02:32:08.791Z","repository":{"id":12549107,"uuid":"15219278","full_name":"queirozfcom/rachinations","owner":"queirozfcom","description":null,"archived":false,"fork":false,"pushed_at":"2015-05-15T02:44:16.000Z","size":1352,"stargazers_count":2,"open_issues_count":29,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T04:45:02.157Z","etag":null,"topics":["dsl","game-engine","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"WhisperSystems/jobmanager","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/queirozfcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-16T07:04:13.000Z","updated_at":"2017-08-30T00:41:06.000Z","dependencies_parsed_at":"2022-09-23T07:52:11.621Z","dependency_job_id":null,"html_url":"https://github.com/queirozfcom/rachinations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queirozfcom%2Frachinations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queirozfcom%2Frachinations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queirozfcom%2Frachinations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queirozfcom%2Frachinations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/queirozfcom","download_url":"https://codeload.github.com/queirozfcom/rachinations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811384,"owners_count":16884305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","game-engine","ruby"],"created_at":"2024-10-11T04:45:03.271Z","updated_at":"2024-10-28T09:10:25.535Z","avatar_url":"https://github.com/queirozfcom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rachinations\n====================\n[![Build Status](https://travis-ci.org/queirozfcom/rachinations.svg?branch=master)](https://travis-ci.org/queirozfcom/rachinations?branch=master)\n[![Code Climate](https://codeclimate.com/github/queirozfcom/rachinations.png)](https://codeclimate.com/github/queirozfcom/rachinations)\n[![Coverage Status](https://coveralls.io/repos/queirozfcom/rachinations/badge.png?branch=master)](https://coveralls.io/r/queirozfcom/rachinations?branch=master)\n[![Gem Version](https://badge.fury.io/rb/rachinations.svg)](http://badge.fury.io/rb/rachinations)\n\nThis is a port of Dr. J. Dormans' [Machinations framework](http://www.jorisdormans.nl/machinations/) into Ruby.\n\nIt provides a Ruby-based DSL to enable game designers to create and also test tentative game designs and/or prototypes.\n\n## Contents\n\n- Classes to model the domain\n- Tests\n- A simple DSL (Domain-specific language) whose objective is to enable anyone to write Machinations diagrams, run them, obtain metrics, compose subdiagrams and so on.\n\n## Installation Guide\n\nRachinations is written in Ruby so you need to have Ruby installed on your system. You only need 5 minutes to get it to work:\n\n**Linux**\n\n  The best way to install Ruby on a Linux-based machine is probably RVM. [Instructions on how to install RVM on Linux here](http://queirozf.com/entries/tutorial-and-examples-on-how-to-use-rvm-on-linux)\n\n  Once Ruby is installed, you just need to install the rachinations **gem**. The process is straightforward:\n\n  ```\n  $ gem install rachinations\n  ```\n\n**Windows**\n\n  - **Installation**\n\n  On Windows, the best way to get up and running with Ruby is probably using the [RubyInstaller for Windows](http://rubyinstaller.org/)\n\n  Please note that Rachinations requires at least Ruby **version 2.1** to work.\n\n  If you have never used Ruby before, I recommend you tick the following two boxes, as per the following image:\n\n  ![installing_ruby_on_windows](http://i.imgur.com/Y0u1ZzN.png)\n\n  - **Veryfing that the installation worked**\n\n  Once Ruby is installed, open a **command prompt** and type `ruby -v` just to see if everything worked.\n\n  You should see something like this (details may vary slightly)\n\n  ```\n  \u003e ruby -v\n  ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]\n  ```\n\n  - **Configuring rubygems and installing the library**\n\n  Once that's done, we'll configure `gem` (Ruby's package manager) to address a well known problem that has to do with certificates on Windows. More info [here](http://stackoverflow.com/questions/9962051/could-not-find-a-valid-gem-in-any-repository-rubygame-and-others) and [here](http://help.rubygems.org/discussions/problems/19761-could-not-find-a-valid-gem).\n\n  On the command prompt, do this:\n\n  ```\n  \u003e gem sources -r https://rubygems.org\n  ```\n  and\n\n  ```\n  \u003e gem sources -a http://rubygems.org\n  https://rubygems.org is recommended for security\n\n  Do you want to add this insecure source? [yn] y\n  http://rubygems.org added to sources\n  ```\n\n  After you've done the last step (which adds a new source for gems to be fetched from), then you can install the gem proper:\n\n  ```\n  \u003e gem install rachinations\n  ```\n  (you might see a few error messages, but don't worry)\n\n## Usage\n\nAll you need to do is write your diagram in a file whose name ends in `.rb` and run it using the `ruby` command.\n\n### Examples\n\n- **Simplest possible example**\n\n ```ruby\n require 'rachinations'\n\n # this is a simple diagram with a single pool with\n # 5 resources\n d=diagram 'simplest_diagram' do\n     pool initial_value: 5\n end\n\n # and execute it for 10 rounds\n d.run 10\n ```\n\n Save this code into a file (say, `static_diagram.rb`) and run it like this:\n\n ```\n $ ruby static_diagram.rb\n ```\n\n- **Example 1**\n\n ```ruby\n require 'rachinations'\n\n diagram 'example_1' do\n     source 's1', :automatic\n     pool 'p1'\n     pool 'p2', :automatic\n     edge from: 's1', to: 'p1'\n     edge from: 'p1', to: 'p2'\n end\n ```\n\n- **Example 2**\n\n ```ruby\n require 'rachinations'\n\n diagram 'example_2' do\n     source 's1'\n     pool 'p1'\n     converter 'c1', :automatic\n     pool 'p2'\n     pool 'p3'\n     edge from: 's1', to: 'p1'\n     edge from: 'p1', to: 'c1'\n     edge from: 'c1', to: 'p2'\n     edge from: 'c1', to: 'p3'\n end\n ```\n\n- **Example 3**\n\n ```ruby\n require 'rachinations'\n\n diagram 'example_3' do\n     source 's1'\n     gate 'g1', :probabilistic\n     pool 'p1'\n     pool 'p2'\n     pool 'p3'\n     sink 's2', :automatic, condition: expr{ p2.resource_count \u003e 30 }\n     edge from: 's1', to: 'g1'\n     edge from: 'g1', to: 'p1'\n     edge 2, from: 'g1', to: 'p2'\n     edge from: 'g1', to: 'p3'\n     edge from: 'p3', to: 's2'\n end\n ```\n\n- **Example 4**\nExample of `:triggers` construct.\n\n ```ruby\n require 'rachinations'\n\n diagram 'example_4' do\n     source 's1'\n     pool 'p1', triggers: 's2'\n     source 's2', :passive\n     pool 'p2'\n     edge from: 's1', to: 'p1'\n     edge from: 's2', to: 'p2'\n end\n ```\n\n- **Example 4, alternate version**\n\n This amounts to the same diagram as the one defined in Example 4, but uses a different mechanism for defining triggers between nodes.\n\n ```ruby\n require 'rachinations'\n\n diagram 'example_4_alternative' do\n     source 's1'\n     pool 'p1'\n     source 's2', :passive, triggered_by: 'p1'\n     pool 'p2'\n     edge from: 's1', to: 'p1'\n     edge from: 's2', to: 'p2'\n end\n ```\n\n- **Example 5**\nUsing gates and fractional edges.\n\n ```ruby\n require 'rachinations'\n\n # in this case, outgoing edges must add up to 1\n diagram 'example_5' do\n    source 's1'\n    edge from: 's1', to 'g1'\n    gate 'g1', :probabilistic\n    # in this case, outgoing edges must add up to 1\n    edge from: 'g1', to:'p1', label: 1/4\n    edge from: 'g1', to:'p2', label: 1/4\n    edge from: 'g1', to:'p3', label: 2/4\n    pool 'p1'\n    pool 'p2'\n    pool 'p3'\n end\n ```\n\n\n## Full DSL specification\n\n### Diagram creation\n\n**Supported options**\n\n- `name`\n - Optional\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `mode`\n - Optional\n - Supported values: `:default`, `:silent` and `:verbose`\n - Default value: `:default`\n\n### Pools, Sources and Sinks\n\n**Supported options**\n\n- `name`\n - Optional\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `initial_value`\n - Optional\n - Type: NATURAL\n - Default value: `0`\n - *Note*: Only applicable to Pools.\n\n- `mode`\n - Optional\n - Supported values: `:push_any`, `:pull_any`, `:push_all` and `:pull_all`\n - Default value: `:push_any` for Sources, `:pull_any` for Pools and Sinks.\n\n- `activation`\n - Optional\n - Supported values: `:passive`, `:automatic` and `:start`\n - Default value: `:automatic` for Sources, `:passive` for Pools and Sinks.\n\n- `condition`\n - Optional\n - Type: EXPRESSION\n - Default value: `expr{ true }` (always evaluates to `true`)\n\n- `triggers`\n - Optional\n - Type: IDENTIFIER\n - Default: `Nil`\n - *Note*: If present, it must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n\n- `triggered_by`\n - Optional\n - Type: IDENTIFIER\n - Default: `Nil`\n - *Note*: If present, it must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n\n### Gates\n\n**Supported options**\n\n- `name`\n - Optional\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `mode`\n - Optional\n - Supported values: `:probabilistic` and `:deterministic`\n - Default value: `:deterministic`\n\n- `activation`\n - Optional\n - Supported values: `:passive`, `:automatic` and `:start`\n - Default value: `:passive`\n\n- `condition`\n - Optional\n - Type: EXPRESSION\n - Default value: `expr{ true }` (always evaluates to `true`)\n\n- `triggers`\n - Optional\n - Type: IDENTIFIER\n - Default: `Nil`\n - *Note*: If present, it must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n\n- `triggered_by`\n - Optional\n - Type: IDENTIFIER\n - Default: `Nil`\n - *Note*: If present, it must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n\n### Converters\n\n**Supported options**\n\n- `name`\n - Optional\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `mode`\n - Optional\n - Supported values: `:push_any`, `:pull_any`, `:push_all` and `:pull_all`\n - Default value: `:push_all`\n\n- `activation`\n - Optional\n - Supported values: `:passive`, `:automatic` and `:start`\n - Default value: `:passive` \n\n### Edges\n\n**Supported options**\n\n- `name`\n - Optional\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `from`\n - Required\n - Type: IDENTIFIER\n - *Note*: It must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n\n- `to`\n - Required\n - Type: IDENTIFIER\n - *Note*: It must be the name of a Diagram element that already exists or that will be added until the end of Diagram definition.\n \n- `label`\n - Optional\n - Type: POSITIVE REAL\n - Default value: `1`\n\n### Stop conditions\n\n**Supported options**\n\n- `name`\n - Optional if this is the only stop condition in the whole Diagram. Required otherwise.\n - Type: IDENTIFIER\n - Default value: `Nil`\n - *Note*: If present, this option must be the first one given.\n\n- `condition`\n - Required\n - Type: EXPRESSION\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueirozfcom%2Frachinations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqueirozfcom%2Frachinations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueirozfcom%2Frachinations/lists"}