Recommend
7 
 Thumb up
 Hide
28 Posts
1 , 2  Next »   | 

Dominion» Forums » General

Subject: Online/Offline Dominion program (big UPDATE) rss

Your Tags: Add tags
Popular Tags: [View All]
Adam Dot
United States
Rhode Island
flag msg tools
I wrote a program to play Dominion. It can play offline (vs. a bad AI or another person on one computer) or online. It has every card including Alchemy, and about 60 custom cards my playgroup uses.

Download it in individual files, zip, or tar and run dominion.rb. To run it, you will need to install Ruby 1.9.1 or better, which you can get here.

If you run the program without arguments, it will go through a menu. If you want to play against the computer, run the program with "-" or "--normal" as the only argument. More information is in the help file.

The documentation is a bit of a work in progress, but everything should work fine out of the box.
5 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Scott Heise
United States
San Jose
California
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
I got an error when I tried to open the file. Windows 7 says the zip file is invalid.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Canada
Winnipeg
Manitoba
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
I got an error trying to unzip it as well. ..
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
My bad, that was a .tar file that I decided to give the wrong extension. Link fixed now.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
J@vier S@ndoval
Mexico
Unspecified
Unspecified
flag msg tools
mbmb
Re: Online/Offline Dominion program
Where is the executable file?
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
The main file is dominion.rb, as the readme says. It depends on your system, but if you have Ruby 1.9 and Facets, you should just be able to run dominion.rb. I might look into bundling in the parts of Facets I use, so you wouldn't need the extra library.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Michael Turner
United States
Unspecified
California
flag msg tools
Re: Online/Offline Dominion program
Can someone walk me through step by step how to get this to work. I've installed ruby but that sudo gem install facets command doesn't seem to be working and the dominion.rb file doesn't seem to run (no errors just doesn't seem to do anything).
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Jordan McKible
msg tools
Re: Online/Offline Dominion program
My hats off to you. This code is zany (I mean that in the best possible way.) As someone who's done the same thing, I find it really interesting to see how two people go about solving the same problem. We used the same language, but they read totally differently. There seem to be a lot of us implementing Dominion - I wish more people would share their source code.

For reference, here's my source http://github.com/jmckible/dominion
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Richard Morris
Scotland
Harrogate
North Yorkshire
flag msg tools
designer
Join the BGG Folding @Home Team !!
badge
This user had more :gg: than sense
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
From where I sit, it would sound to be especially important to put as much implementation effort as possible into the AI. After all, who needs n different interfaces as long as they work? So trying to share code would be great.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
@Jordan: That is cool. Your code is definitely more organized than mine. I might take some ideas there (or at least motivation) to organize my code better. I'm going to take a closer look at your code later.
I tried to focus on making the game engine extensible and general enough that it could handle lots of weird effects, as exemplified by the custom cards.

@people: I don't really know about running ruby/gems on Windows, but I'm going to try to package the whole thing in a .exe. If you're running mac/linux and you know how to use a terminal, you shouldn't have much trouble.
You need to update to Ruby 1.9, install facets (sudo gem install facets), and run "ruby dominion.rb" or "ruby dominion.rb --help" from the dominion directory.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Branko K.
msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
I'm not experienced with Ruby, and even after installing Facets all I get is a message I need to install facets.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Krzysiek
Poland
flag msg tools
badge
Avatar
Re: Online/Offline Dominion program
I got as far as installing Ruby on Windows (I got it from here) and installing Facets (after installing Ruby type "gem install facets" in the command line), but running dominion.rb gives the following error message:

D:/dominion/card.rb:258:in `eval': wrong number of arguments(2 for 0) (ArgumentE
rror)
from D:/dominion/util/wrap.rb:8:in `[]'
from D:/dominion/util/wrap.rb:8:in `block in before'
from D:/dominion/money.rb:63:in `new'
from D:/dominion/money.rb:63:in `M'
from D:/dominion/card.rb:146:in `cost'
from (eval):3:in `'
from (eval):2:in `vcard'
from D:/dominion/card.rb:258:in `eval'
from D:/dominion/card.rb:258:in `vcard'
from D:/dominion/card.rb:260:in `'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/facets-2.8.3/lib/core/facets/ker
nel/require_relative.rb:19:in `require'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/facets-2.8.3/lib/core/facets/ker
nel/require_relative.rb:19:in `require_relative'
from D:/dominion/dominion.rb:29:in `'
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
United States
Collegeville
Pennsylvania
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
Is Ruby from the Alchemy expansion?
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Blue Fox
United States
Kentucky
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
Ruby is programming framework.
2 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
@Branko: Do you have Ruby 1.9?

@Krzysztof: Should be fixed now. Try redownloading the program.

By the way, I should have mentioned that this is a text-based program, it is wasn't clear from the lack of images.
1 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Drew Spencer
United States
Tucson
Arizona
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
ScottB wrote:
Is Ruby from the Alchemy expansion?


It's from a future expansion that has yet another unique currency called "Facets."
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Erin Wolthausen
United States
San Francisco
California
flag msg tools
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
Ruby
Type: Treasure
Cost: 0
Worth 4 Coin

Ruby on Rails
Type: Action-Duration
Cost: 0
Gain one Ruby.
If any player gets AP while Ruby on Rails is in play, they lose their turn.

(Warning: these cards have not been playtested, and may be underpowered.)
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
John Earles
Canada
Toronto
Ontario
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
psly4mne wrote:
By the way, I should have mentioned that this is a text-based program, it is wasn't clear from the lack of images.


For any Windows users you may want to install the win32console gem to allow the ANSI codes to work. The following works for me in my environment - ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32].

1) At ruby command prompt: gem install win32console

2) Add the following lines to the top of dominion.rb (under #!/usr/bin/env ruby)


begin
require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/ or RUBY_PLATFORM =~ /i386-mingw32/
rescue LoadError
raise 'You must gem install win32console to use color on Windows'
end
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
Thanks John. I've added that to the file. I don't have access to Windows right now, and I don't really have any experience with Windows.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Branko K.
msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
psly4mne wrote:
@Branko: Do you have Ruby 1.9?


Ruby 1.9.1. I also installed facets via "gem install facets" command and it supposedly installed successfully.

Dunno what might be wrong.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Adam Dot
United States
Rhode Island
flag msg tools
Re: Online/Offline Dominion program
That is odd - it must not be finding it. I don't think I can help you with that, but the most recent version should be able to run without Facets (no guarantees though).

Also, if anyone has trouble with the color bit or weird text showing up, you can replace color.rb with uncolor.rb to disable color.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Carl Johan Ragnarsson
Sweden
Lund
Unspecified
flag msg tools
badge
mbmbmbmbmb
Re: Online/Offline Dominion program
Anyone got this running on Win yet?

After installing facets and win32console...


C:\Ruby19\bin>ruby dominion/dominion.rb
C:/Ruby19/bin/dominion/util/extensions.rb:69:in `read': No such file or director
y - texts.txt (Errno::ENOENT)
from C:/Ruby19/bin/dominion/util/extensions.rb:69:in `read_local'
from C:/Ruby19/bin/dominion/card.rb:179:in `'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/facets-2.8.3/lib/core/facets/ker
nel/require_relative.rb:19:in `require'
from C:/Ruby19/lib/ruby/gems/1.9.1/gems/facets-2.8.3/lib/core/facets/ker
nel/require_relative.rb:19:in `require_relative'
from dominion/dominion.rb:51:in `'
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
John Earles
Canada
Toronto
Ontario
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
minismurf wrote:
Anyone got this running on Win yet?


It's working for me...

You need to run the program directly within your dominion directory. You should be executing the command:

ruby dominion.rb
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
Carl Johan Ragnarsson
Sweden
Lund
Unspecified
flag msg tools
badge
mbmbmbmbmb
Re: Online/Offline Dominion program
Maybe I am a bit dense, but ruby is not a recognized command except in the ruby/bin folder... I am obviously doing something wrong, but not quite sure what.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
John Earles
Canada
Toronto
Ontario
flag msg tools
badge
Avatar
mbmbmbmbmb
Re: Online/Offline Dominion program
minismurf wrote:
Maybe I am a bit dense, but ruby is not a recognized command except in the ruby/bin folder... I am obviously doing something wrong, but not quite sure what.


Make sure you have your ruby/bin folder appended to your PATH environment variable. You can do this either in the Control Panel or by typing set PATH=[your ruby/bin directory];%PATH% at the command line.

Edit: If you used Ruby Installer for Windows to set up your environment you should have a Start Menu item called Ruby 1.9.1-p378 | Start Command Prompt with Ruby that also will open a command line and ensure your environment variables are set properly.
 
 Thumb up
 tip
 Hide
  • [+] Dice rolls
1 , 2  Next »   | 
Front Page | Welcome | Contact | Privacy Policy | Terms of Service | Advertise | Support BGG | Feeds RSS
Geekdo, BoardGameGeek, the Geekdo logo, and the BoardGameGeek logo are trademarks of BoardGameGeek, LLC.