asilano / free-dom Goto Github PK
View Code? Open in Web Editor NEWImplementation of the card game Dominion
Home Page: https://free-dom.nsict.org
Implementation of the card game Dominion
Home Page: https://free-dom.nsict.org
From Clive on ToothyWiki:
Hilariously subtle bug: I have Secret Chamber and some other cards in hand. Opponent Attacks. I am given a "react"/"don't react" choice. I choose to react, draw two cards, put two cards including the Secret Chamber on top of my deck. Now I have no reactions in hand, but I am still given a spurious "don't react" dialog with no "react" buttons remaining. (-8
Regardless of other checks, there's never a reason to ask the player to play treasures individually if they're not holding any!
A suggestion from Clive on ToothyWiki:
AutoMasquerade. Pass on a Curse if you have one, otherwise an Estate, otherwise a Copper, otherwise prompt as usual.
I might extend this slightly to offer two options: Curse->Estate->Copper->prompt, and Curse->Copper->Estate->prompt.
undefined method `cards' for nil: NilClass
While processing play_action
Whenever the game updates via AJAX (either a regular check-for-changes, or due to a button click), the chat input box is cleared.
Chowlett's turn 15 started.
Chowlett played Native Village.
Chowlett reclaimed the cards from Native Village.
Chowlett played Witch.
Chowlett drew Copper, Curse.
Alex reacted with a Moat, negating the attack.
qqzm gained a Curse.
max gained a Curse.
====> Chowlett played no action. <====
Game will end at end of the current turn.
Chowlett bought Estate for 2.
At the marked point (that is, on clicking "Leave Action Phase"), the game appeared to return 500; treasures were played but I had no cash.
Add social network buttons (Facebook Like, Google +1) for publicity
Rules makes it quite clear that "other players" with only one card in hand have the choice to discard it (perhaps they expect to draw Library off a Caravan?) Code does not allow that.
It does count them, but it doesn't report them separately.
Allow players to play (unrated) games against an opponent who just buys the best out of Silver, Gold, Province they can afford.
Can't choose a card to set aside. Caused by pending action with substep, but no matching substepped resolve action.
Ambassador, returning 1 Curse from hand with no others, makes you click "Return no more" even though it's the only option.
I have mused that Ambassador might work more smoothly if for each card in hand it offered "Reveal and return", "Reveal but don't return", and (where applicable) "Reveal and return 2", but that's a rather more drastic change than just automatically detecting there are no more to return.
Seen in:
Extract from game 88:
Alex played Moat.
Alex drew Copper, Copper.
Alex played Copper, Copper, Copper as Treasures.
Alex played Loan.
Alex's Loan revealed: Moat.
Alex revealed Copper.
Alex has 4 total cash.
Alex chose to trash their Copper.
Alex bought Warehouse for 3.
Alex (Turn Alex:9): Slightly odd history ordering there: "has 4 total cash" before "chose to trash Copper"?
Chowlett (Turn Chowlett:10): Hmm, yes. Reason is that you play Loan, the game notices it was your last treasure and logs, then lets you handle the Loan's action. May not be trivial to reorder it.
Chowlett (Turn Chowlett:10): Make an issue on github?
max played Rabble.
The line above is red because Rabble is an attack.
max played Throne Room.
max chose Rabble to double.
Neither of these lines shows up red, which is slightly confusing.
Low sev, and I'm not quite sure what should be done about it, but a little glitch I thought I should mention.
At present, you need 5 clicks to put the cards back. Can surely do it in one.
Due to a bug in prototype-rails. Will be fixed by moving to jQuery-rails.
As in, if Alex and Clive need to pass a card in Masquerade, the "Waiting for" list shows Alex and Clive just once, but the title text for the page says "Alex, Alex, Clive, Clive to act".
My stylesheets are a maze of little twisty selectors, all alike.
May want to consider Compass.
As subject
If you've played enough actions for Peddler to cost less than 4, then Talisman should double it. It does, unless it's your last buy - because the Buy pending action is destroyed before the buy happens, meaning Peddler's cost goes up just before Talisman sees it.
Shouldn't destroy the action until after it's been processed. That's probably a general truth, but care will be needed to make sure it doesn't break anything.
I often used and
, or
and not
in conditional statements; they're wrong for those, having unexpected precedence (the canonical example is
a = true and false # => false
puts a # => "true"
This will also involve fixing up a number of places where I use the no-parens calling convention unsafely: foo.include? :bar and foo[:bar]
works because of and
's low precedence; but foo.include? :bar && foo[:bar]
is wrong - it evaluates to foo.include?(:bar && foo[:bar])
Max set his username to "xam". This made the index page show largely in reverse.
Since free-dom saves your user-session info via cookie, it technically needs to tell you it's doing that.
It looks like I fixed Bank's multi-logging at some point, but in the process I may have stopped other special treasures from logging at all. Needs investigation.
For instance, Swindler need not be order-relevant if the only pile with fewer cards than players is actually empty.
Logentries and NewRelic suggest that check_change is regularly taking longer than it should, and most of that appears to be reading PendingActions. Investigate why.
Don't need to play treasures individually if
While Venture would make the above still need the slow interface, Venture is a Special treasure, so it forces it anyway.
It's far too tricky to send announcement emails via the console. Add a (webmaster only) interface for sending announcements.
History contains:
Probably missing an = in <% fields_for %>
Rails 3 seems to wrap label-field pairs in div.field, not p.
Want div.field_with_errors to gain style. Consider
div.field_with_errors
{
label { color: red; font-style: italic;}
input, select {box-shadow: 0 0 5px 1px red;}
}
Since ended games get automatically destroyed, no need to have a "destroy" link.
Replace instead with a button in-game to game players and admin to end the game, if inactive for more than (say) a week.
If a game has a PBEM player, actions shouldn't return a failure if the email sending fails.
However, the email does need to be sent, so any failure must be spotted and retried. Look into DelayedJob, perhaps?
Alex played Rabble.
qqzm revealed Estate, Estate, Ambassador.
Waiting for:
qqzm to Put a card 2nd from top
Not really a necessary decision.
Low priority, but it'd be nice to fix it (similarly to other similar decisions such as autoBaron etc) next time someone's looking at the code.
It wants to be a "sticky footer" - but it's made a bit more tricky by the top 2em margin.
If your button-click fails, at present the UI doesn't tell you - it just stays disabled. I should stick something into flash.
Can't remember the precise error message (can dig it out if you want). Works OK to watch or join games, but on your turn (or when action is otherwise needed), clicking any action button gives a JS error about unknown property/method (and fails to submit the action).
...but note that this depends on issue #6 (UJS Confirms broken)
We've had a number of new users, but none has ever really played a game.
Here's my royal_seal_talisman.feature integration test. It seems that the Talisman doesn't make me gain a Silver if I have a Royal Seal out.
Feature: Royal Seal + Talisman
Background:
Given I am a player in a standard game with Feast
Scenario: Buy cheap cards with Talisman + Royal Seal
# The Royal Seal explicitly affects "gains", so the extra copies gained
# by Talisman are eligible for top-of-deck treatment.
Given my hand contains Woodcutter, Talisman, Royal Seal, Gold
And it is my Play Action phase
When I play Woodcutter
Then I should have 2 buys available
When the game checks actions
Then I should have played Talisman, Royal Seal, Gold
And it should be my Buy phase
And I should have 8 cash available
When I buy Silver
And the game checks actions
Then I should need to Choose whether to place Silver on top of deck
When I choose the option On deck
Then I should have put Silver on top of my deck
[ So far so good... ]
And I should need to Choose whether to place Silver on top of deck
[ But nope. /Choose whether to place Silver on top of deck/i not found in ["Buy"]. ]
When I choose the option On deck
Then I should have put Silver on top of my deck
And I should need to Buy
When I buy Feast
And the game checks actions
Then I should need to Choose whether to place Feast on top of deck
When I choose the option On deck
Then I should have put Feast on top of my deck
And I should need to Choose whether to place Feast on top of deck
When I choose the option Discard
Then I should have gained Feast
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.