Lomic

Lomic is a Domain Specific Language (DSL) intended to be used for Pomic, a programming version of the game Nomic.

Getting Started

Installing

Install the gem:

$ gem install lomic

Or grab the latest code from github:

$ git clone git://github.com/mindeavor/lomic.git

Quick Example

# simple.rb

class Globals < Lomic
  var :didiwin => 'No...'
end

rule 101 do |g| # g refers to globals
  event "game:start" do
    puts '[Example: simple.rb]'
    g.didiwin = 'Yes!'
    set_next "game:test1"
  end

  event "game:test1" do
    puts "Did I win? #{g.didiwin}"
  end
end

# myParseFile.rb

require 'lomic'
gstate = Lomic.parse('simple.rb', 'game:start')

What does Lomic look like?

Lomic is designed to be expressive in declaring rules for the game Nomic:

class Globals < Lomic
  var :players => []
  var :currentPlayer
end

class Player < Lomic
  resource :hp => 15 # resources have a max and min value
end

rule 101 do |g| # g refers to globals
  ### The game begins with 4 players.
  ### Each player is assigned a unique number.
  event "game:start" do
    Player.new_var :number => 0
    4.times do |i|
      p = Player.new
      p.number = i
      g.players.push(p)
    end
  end
end

rule 102 do |g|
  ### At the beginning of each player's turn,
  ### that player takes 3 damage
  event "turn:start" do
    currentPlayer.hp -= 3
  end
end

Check out the ‘examples/` folder to see what Lomic is supposed to look like, and `parse.rb` to see how to use Lomic (in its current, underdeveloped state)

Contributing

Lomic is currently in the concept and development stage. To discuss contributing, syntax, goals, or implementation, join us at #lomic on irc.freenode, or email me at gilbertbgarza aT gmail

Copyright © 2010 Gilbert B Garza. See LICENSE for details.