[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[LINK] Ruby DSL for turn-based strategy game

Dr Nic

9/7/2006 9:34:00 AM

"I continue to develop Dr Nicâ??s Civilizations game. This lead me to
develop a DSL for the specification of game rules. You need to see this.

"Hereâ??s an example definition of some terrain:

class Desert < Terrain
title "Desert"
letter "d"
graphic "desert"
movement_cost 1
defense_bonus 10
food 0
shield 1
trade 0
end
class Oasis < Desert
title "Oasis"
special_code 1
food 3
shield 1
trade 0
graphic "oasis"
end

"An Oasis is a special version of the Desert terrain, so Ruby subclasses
offer a compatible relationship."

I've written up why I used a Ruby DSL for this static configuration, and
how it is implemented here:
http://drnicwilliams.com/2006/09/07/turn-based...

Cheers
Nic

--
Posted via http://www.ruby-....