Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 10 11 [12] 13  All

Author Topic: Dominiate: a Dominion simulator that runs on the Web  (Read 248156 times)

0 Members and 1 Guest are viewing this topic.

GeoLib

  • Jester
  • *****
  • Offline Offline
  • Posts: 965
  • Respect: +1265
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #275 on: April 10, 2014, 06:50:01 pm »
+1

I've noticed that JoaT is implemented suboptimally: Jack discards an Estate or Curse when it has none in hand, instead it should usually draw and trash it (at least in the early game):

I've now tried a more reasonable discard strategy by adding

Quote
 
discardPriority: (state, my) -> [
    "Estate" if my.countInHand("Estate")+ my.countInHand("Curse")  > 0 \
    or state.countInSupply("Province") < 6 or my.coins=7
    "Curse" if my.countInHand("Estate")+ my.countInHand("Curse")  > 0 \
    or state.countInSupply("Province") < 3 or my.coins=7
    "Copper"
    "Province"
    "Duchy"
    "Jack of All Trades"
    null
 ]

to the DoubleJack bot. The improvement is astonishing: The win rate against BankWharf increases from 36% to 55%, it now wins 53-47 against DoubleWitch, 67-33 against DoubleMountebank.
And it wins 58-42 against Rebuild!!! Am I dreaming? :o I've let the simulator play 5,000 games to be sure. DoubleJack even beats RebuildRogue, RebuildHorse and RebuildDuke by 54-46 or better.

Does the discardPriority function I added mess something up with the opponent's strategy, or is Rebuild really worse than Jack when both are played reasonably (and without Shelters/Colonies)?
I was also surprised to see that the improved DoubleJack seemed to beat most strategies even better in Colony games (adding the "vanilla" Colony/Plat. gain rules), but there seems to be a serious bug in the simulator for these games; DoubleJack "cheats" by sometimes getting 7 extra Coins from nowhere every few turns (no Coin token cards available):
[...]

It seems I WAS dreaming, and the bug was in my own code (and not just in Colony games, apparently): "my.coins=7" sometimes sets the player Coins count from 0 to 7 in spite of being in an if clause; it should read "my.coins==7" instead. When fixing this, DoubleJack does lose against Rebuild and DoubleWitch.
(My improvement only increases the win rate by 0-4%, far from enough.)

Probably this uses lazy evaluation, so it only looks at that last condition if it can't figure out the result from all the others. That's why you only saw the bug some turns. If it gets to that part it makes sense that it will perform that action though.

I'm glad order has been restored to the universe. Those were some pretty surprising results!
Logged
"All advice is awful"
 —Count Grishnakh

Holger

  • Minion
  • *****
  • Offline Offline
  • Posts: 736
  • Respect: +458
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #276 on: April 11, 2014, 08:07:07 am »
0

Probably this uses lazy evaluation, so it only looks at that last condition if it can't figure out the result from all the others. That's why you only saw the bug some turns. If it gets to that part it makes sense that it will perform that action though.
That's a possible explanation, but in the turns I posted, the simulator shouldn't even have looked at the Estate condition (if it's really lazy :P), since discarding an Estate wasn't even possible with a Copper revealed; also the command inside an if-clause should have triggered an error warning IMO. I was using a single "=" because that's used as the mathematical equality sign in many languages, but of course it's a command in JavaScript. :-[

I'm glad order has been restored to the universe. Those were some pretty surprising results!
I couldn't agree more. Though I would have liked Rebuild to be substantially weaker than some card...
Logged

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #277 on: April 11, 2014, 08:51:33 am »
+2

Probably this uses lazy evaluation, so it only looks at that last condition if it can't figure out the result from all the others. That's why you only saw the bug some turns. If it gets to that part it makes sense that it will perform that action though.
That's a possible explanation, but in the turns I posted, the simulator shouldn't even have looked at the Estate condition (if it's really lazy :P), since discarding an Estate wasn't even possible with a Copper revealed; also the command inside an if-clause should have triggered an error warning IMO.
No, I don't think it is that lazy.  The function discardPriority is called to return the priority of your discards given the (state, my). Afterwards, the possible choices and your priority are matched (iirc).
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #278 on: April 20, 2014, 04:33:44 pm »
+3

Hey all.

I kind of took a year and a half off from Dominion because of Goko. I feel bad that I didn't do any maintenance of Dominiate during that time, but just thinking about Dominion was pretty depressing when I could only play it in person.

I'm back to playing Dominion Online now. It's playable! All the credit goes to the Salvager team, not to Making Fun/Goko.

So now I look at Dominiate and I see that ragingduckd (that's AI, right?) is maintaining a better version of it. That's great! I'm really happy to see that development could carry on without me. And, of course, there are some absolutely enormous pull requests in my GitHub for Dominiate now. I thought that merging the pull requests would be a good way to get back into development, until yesterday I looked at AI's pull request and backed away slowly. That's a lot of code to review on a code base I haven't looked at in a long time.

So here's my question. Should I try to update rspeer/dominiate to once again be the "master" version? Or should I let AI stay in charge and submit pull requests to him? He's of course been much more reliable than me. I think it comes down to whether AI is happy to be running this project when he runs so many other Dominion projects.
Logged

Awaclus

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 11809
  • Shuffle iT Username: Awaclus
  • (´。• ω •。`)
  • Respect: +12849
    • View Profile
    • Birds of Necama
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #279 on: April 20, 2014, 04:37:28 pm »
+2

It's playable! All the credit goes to the Salvager team, not to Making Fun/Goko.
Well, some of it goes to Making Fun. Before Making Fun, it was literally not playable at times.
Logged
Bomb, Cannon, and many of the Gunpowder cards can strongly effect gameplay, particularly in a destructive way

The YouTube channel where I make musicDownload my band's Creative Commons albums for free

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #280 on: April 21, 2014, 08:17:42 am »
0

So here's my question. Should I try to update rspeer/dominiate to once again be the "master" version? Or should I let AI stay in charge and submit pull requests to him? He's of course been much more reliable than me. I think it comes down to whether AI is happy to be running this project when he runs so many other Dominion projects.

By all means, take it back.  I haven't actually worked on it in several months, nor am I really planning to.  I just wanted to add a few DA cards and make it publiclly accessible.  I'll change my link to point to your site whenever you're ready.

FYI, I'm pretty sure I made some mistakes when I added those cards, as I didn't fully appreciate the framework.  I seem to recall that I failed to add default decision rules to the "basic strategy" or something like that.  It resulted in errors when, say, a non-Rebuild strategy somehow ended up with a Rebuild in its deck.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #281 on: April 21, 2014, 09:06:51 am »
+1

So here's my question. Should I try to update rspeer/dominiate to once again be the "master" version? Or should I let AI stay in charge and submit pull requests to him? He's of course been much more reliable than me. I think it comes down to whether AI is happy to be running this project when he runs so many other Dominion projects.

By all means, take it back.  I haven't actually worked on it in several months, nor am I really planning to.  I just wanted to add a few DA cards and make it publiclly accessible.  I'll change my link to point to your site whenever you're ready.

FYI, I'm pretty sure I made some mistakes when I added those cards, as I didn't fully appreciate the framework.  I seem to recall that I failed to add default decision rules to the "basic strategy" or something like that.  It resulted in errors when, say, a non-Rebuild strategy somehow ended up with a Rebuild in its deck.

I fixed these if I happen to run into them.

Anyway, I think what one thing that someone might want to take a decision on is some generic trashing function, as there are some problems with onTrash effects. See http://forum.dominionstrategy.com/index.php?topic=619.msg349859#msg349859
Fixed a problem for Saboteur there, saw it for Mint and Rebuild.

I don't see an easy way for a generic function, maybe we should just fix the cards where it is the case.  But maybe someone has an idea...
Logged

Holger

  • Minion
  • *****
  • Offline Offline
  • Posts: 736
  • Respect: +458
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #282 on: April 29, 2014, 06:47:28 pm »
0

So here's my question. Should I try to update rspeer/dominiate to once again be the "master" version? Or should I let AI stay in charge and submit pull requests to him? He's of course been much more reliable than me. I think it comes down to whether AI is happy to be running this project when he runs so many other Dominion projects.

By all means, take it back.  I haven't actually worked on it in several months, nor am I really planning to.  I just wanted to add a few DA cards and make it publiclly accessible.  I'll change my link to point to your site whenever you're ready.

BTW, is there a list of all implemented cards somewhere? It seems most but not all pre-DA cards are included, plus a few DA cards...
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #283 on: April 29, 2014, 10:07:47 pm »
+1

The only complete list is the code and its semi-documentation.

I could summarize, though, that the implemented cards are:

  • All but 11 of the pre-Dark Ages cards -- the missing ones are listed on the issues page
  • Sage, Graverobber, and Poor House
Logged

Holger

  • Minion
  • *****
  • Offline Offline
  • Posts: 736
  • Respect: +458
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #284 on: April 30, 2014, 12:36:44 pm »
0

The only complete list is the code and its semi-documentation.

I could summarize, though, that the implemented cards are:

  • All but 11 of the pre-Dark Ages cards -- the missing ones are listed on the issues page
  • Sage, Graverobber, and Poor House

Thanks for the summary; that's quite a lot of cards. But I'd also be interested in the list of cards added on AI's version (like Rebuild), which are not in the code's documentation.
Logged

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #285 on: April 30, 2014, 06:45:24 pm »
0

The only complete list is the code and its semi-documentation.

I could summarize, though, that the implemented cards are:

  • All but 11 of the pre-Dark Ages cards -- the missing ones are listed on the issues page
  • Sage, Graverobber, and Poor House

Thanks for the summary; that's quite a lot of cards. But I'd also be interested in the list of cards added on AI's version (like Rebuild), which are not in the code's documentation.

You can download my version here.  If my server weren't down right now, you'd be able to run it at gokosalvager.com (follow the link at the top).

I think Dstu's version is the most recent, however: https://github.com/DStu-dominion/dominate [Edit: Nope, see Dstu's response below]

« Last Edit: April 30, 2014, 06:50:11 pm by ragingduckd »
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #286 on: April 30, 2014, 06:47:51 pm »
+1

The only complete list is the code and its semi-documentation.

I could summarize, though, that the implemented cards are:

  • All but 11 of the pre-Dark Ages cards -- the missing ones are listed on the issues page
  • Sage, Graverobber, and Poor House

Thanks for the summary; that's quite a lot of cards. But I'd also be interested in the list of cards added on AI's version (like Rebuild), which are not in the code's documentation.

You can download my version here.  If my server weren't down right now, you'd be able to run it at gokosalvager.com (follow the link at the top).

I think Dstu's version is the most recent, however: https://github.com/DStu-dominion/dominate

https://github.com/DStu-dominion/dominate/network looks like everything is merged.
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #287 on: May 01, 2014, 01:38:50 am »
+5

I did the merge! I also implemented default strategies for Rats and Rebuild, so they wouldn't crash SillyAI or any other AI that finds itself holding those cards.

The default Rebuild strategy is basically the same as the Rebuild.coffee AI. The default Rats strategy is
Code: [Select]
  wantsToPlayRats: (state) -> no

So the new version is up at its old place: http://rspeer.github.io/dominiate/play.html
Logged

c4master

  • Moneylender
  • ****
  • Offline Offline
  • Posts: 167
  • Respect: +56
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #288 on: May 24, 2014, 03:49:43 am »
0

Are you going to implement a "basic engine bot", e.g. some strategy that tries to go for the engine on every board? It would be nice to see how it competes against the other AIs.
Logged

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #289 on: May 26, 2014, 10:44:06 pm »
0

So the new version is up at its old place: http://rspeer.github.io/dominiate/play.html

Finally fixed the links to this on gokosalvager.com.  Sorry I forgot to do it earlier.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #290 on: June 02, 2014, 09:55:03 am »
0

I don't know these parts of the program good enough, but how much work would it to get some sort of console mode?

I mean there is play.coffee, this is great for testing as it plays one game with log.
What I would want is a variant that for 2 given strategies plays N games and just outputs the result.
Logged

BierDaniel

  • Pawn
  • **
  • Offline Offline
  • Posts: 4
  • Respect: 0
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #291 on: October 25, 2014, 03:14:08 pm »
0

Hi. I dont know if someone is still workimg on this project or even looking in this thread. But perhaps someone may help me. On the github page is written this can be run on windows using the compile.bat in the web folder:
On Windows: you can now compile the CoffeeScript files on Windows, using an included CoffeeScript compiler, windows/coffee.exe. (Being an .exe file downloaded from the Internet, you of course run this at your own risk.)
Running windows/compile.bat should do the Right Thing, but I haven't tested it. See windows/README for more information.


In the README is written:
- Edit the *.coffee files however you want (using a good editor such as
  Notepad++)
- Run "compile.bat" from this folder, which will compile them into web\playWeb.js
- Assuming that worked, open web\play.html in Firefox or Chrome and test it
  out.


I tried to do it, but it doent work. After running compile.bat there exists no playWeb.js in the web folder. I can start play.html and there opens a page very similiar to the link from the webstart given in this thread, but there are no strategies to choose (empty boxes) and if I write or copy them and hit the start playing button nothing happens.
Perhaps I do some mistake or there is a small mistake in the compile.bat?
Looking at the compile.bat with notepad+ shows:
coffee.exe -c -j ..\web\playWeb.js ..\playWeb.coffee ..\basicAI.coffee ..\cards.coffee ..\gameState.coffee
coffee.exe -c ..\web\multiLog.coffee
coffee.exe -c ..\web\scoreTracker.coffee


Sorry for my bad english and I hope someone may help me.
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #292 on: October 25, 2014, 03:18:36 pm »
0

Sounds like compile.bat didn't actually work. Did you see any output?

By the way, does anyone know if there's a more modern way to support compiling CoffeeScript in Windows, now that people actually use node.js in Windows?
Logged

BierDaniel

  • Pawn
  • **
  • Offline Offline
  • Posts: 4
  • Respect: 0
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #293 on: October 25, 2014, 03:48:11 pm »
0

Thanks for the very fast answer. Starting compile.bat opens a black window: C:\Windows\system32\cmd.exe with the following text:

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master\windows>coffee.exe -
c -j ..\web\playWeb.js ..\playWeb.coffee ..\basicAI.coffee ..\cards.coffee ..\ga
meState.coffee


Then it works a while, after this come a few more lines, but the window closes very fast after it.
I added pause to the bat and get the following:

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master\windows>coffee.exe -
c -j ..\web\playWeb.js ..\playWeb.coffee ..\basicAI.coffee ..\cards.coffee ..\ga
meState.coffee
coffee-script-builtin.js:8      out of memory
Execution error in main.js.

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master\windows>coffee.exe -
c ..\web\multiLog.coffee

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master\windows>coffee.exe -
c ..\web\scoreTracker.coffee

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master\windows>pause
Drücken Sie eine beliebige Taste . . .

What can I do?
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #294 on: October 27, 2014, 03:16:32 am »
0

Out of memory? Well, I guess that's one way to show that the random standalone CoffeeScript compiler I included doesn't work.

If you don't mind running a few more things at the command line, here's a link that I think is up to date about how to install CoffeeScript on Windows: http://stackoverflow.com/a/14981509

There's lots of answers on that page, but I'm suggesting in particular the one where you install node.js and use npm. I haven't tried it, but it's the most similar to what you'd do on other OSes.

You also may be able to get it as a plugin for a particular development environment, such as Visual Studio.
Logged

BierDaniel

  • Pawn
  • **
  • Offline Offline
  • Posts: 4
  • Respect: 0
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #295 on: October 27, 2014, 07:07:09 am »
0

I installed nodejs and and coffescript the way written in your link.
I get following message installing coffescript:

C:\>npm install -g coffee-script
C:\Users\Daniel\AppData\Roaming\npm\coffee -> C:\Users\Daniel\AppData\Roaming\np
m\node_modules\coffee-script\bin\coffee
C:\Users\Daniel\AppData\Roaming\npm\cake -> C:\Users\Daniel\AppData\Roaming\npm\
node_modules\coffee-script\bin\cake
coffee-script@1.8.0 C:\Users\Daniel\AppData\Roaming\npm\node_modules\coffee-scri
pt
└── mkdirp@0.3.5


so it seemed to work, but when I tried to run I get the following:

C:\Users\Daniel\Downloads\dominiate-master\dominiate-master>coffee play.coffee s
trategies/BigMoney.coffee strategies/ChapelWitch.coffee
Error: Cannot find module 'coffee-script'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (C:\Users\Daniel\Downloads\dominiate-master\dominiate-ma
ster\play.coffee:9:10)
  at Object.<anonymous> (C:\Users\Daniel\Downloads\dominiate-master\dominiate-ma
ster\play.coffee:6:1)
  at Module._compile (module.js:456:26)


Any ideas what am I making wrong?
Logged

rspeer

  • Witch
  • *****
  • Offline Offline
  • Posts: 469
  • Respect: +877
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #296 on: October 29, 2014, 10:40:10 am »
0

No. I'm sorry, but I really don't know. It might be time to ask on StackOverflow or something, where you might find someone who has used Node and CoffeeScript on Windows.
Logged

BierDaniel

  • Pawn
  • **
  • Offline Offline
  • Posts: 4
  • Respect: 0
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #297 on: October 31, 2014, 04:04:30 pm »
0

Perhaps another approach. I forked your project on github, so that I can implement new strategies or new cards. How can I do a website like your "http://rspeer.github.io/dominiate/play.html#DoubleJack/BankWharf" and test my new strategies or cards. If I get to my browser "http://bierdaniel.github.io/dominiate/play.html#DoubleJack/BankWharf" I get a error file not found. I can work with your webapp, so there must be a possibility to run it from my account with nearly the same files, or? I am thanking for your much help and if I get something productive to work and you want to use it I will obvisouly give it to you.
Logged

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #298 on: October 31, 2014, 06:36:38 pm »
0

I don't want to sound unconstructive, but if you are able to let dominiate run anywhere,  you are able to install a Linux and apache and run it on localhost.  And it's probably also the easiest way...

But nice to see someone else again getting into this, I've been missing the time/energy to do much on it recently...
« Last Edit: October 31, 2014, 06:38:09 pm by DStu »
Logged

Seprix

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5607
  • Respect: +3676
    • View Profile
Re: Dominiate: a Dominion simulator that runs on the Web
« Reply #299 on: March 13, 2015, 11:44:32 pm »
0

This is all I have for Dominion Sims, since I have a Mac, and I'm not planning on getting a PC or buying Licenses for Windows so I can use a VM.

Sadly I'm terrible at coding, so this probably won't be fantastic for me anyways. :/
« Last Edit: March 13, 2015, 11:48:06 pm by Seprix »
Logged
DM me for ideas on a new article, either here or on Discord (I check Discord way more often)
Pages: 1 ... 10 11 [12] 13  All
 

Page created in 0.228 seconds with 21 queries.