Skip to content

Commit

Permalink
Fix: initial number of victory cards.
Browse files Browse the repository at this point in the history
Support 5- and 6-player games.
  • Loading branch information
blynn committed Sep 28, 2012
1 parent 5bb576e commit 3a01d0d
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,9 @@ func main() {
out: make(chan string),
}
game.players = []*Player{
&Player{name: "Anonymous", fun: ng},
//&Player{name: "Anonymous", fun: ng},
&Player{name: "Ben", fun: consoleGamer{}},
//&Player{name: "AI", fun: SimpleBuyer{[]string{"Province", "Gold", "Silver"}}},
&Player{name: "AI", fun: SimpleBuyer{[]string{"Province", "Gold", "Silver"}}},
}
players := game.players

Expand Down Expand Up @@ -974,18 +974,23 @@ func main() {
setSupply("Gold", 30)

numVictoryCards := func(n int) int {
switch n {
case 2:
if n < 2 || n > 6 {
panic(n)
}
if n == 2 {
return 8
case 3:
return 12
case 4:
return 12
}
panic(n)
}
return 12
}(len(players))

for _, s := range []string{"Estate", "Duchy", "Province"} {
setSupply(s, numVictoryCards(len(players)))
setSupply(s, numVictoryCards)
}
if len(players) > 4 {
setSupply("Province", 3 * len(players))
setSupply("Copper", 120 - 7 * len(players))
setSupply("Silver", 80)
setSupply("Gold", 60)
}
setSupply("Curse", 10*(len(players)-1))
layout := func(s string, key byte) {
Expand Down Expand Up @@ -1050,7 +1055,11 @@ Underlings:Baron,Cellar,Festival,Library,Masquerade,Minion,Nobles,Pawn,Steward,W
pr := presets[rand.Intn(len(presets))]
fmt.Printf("Playing %q\n", pr.name)
for i, c := range pr.cards {
c.supply = 10
if isVictory(c) {
c.supply = numVictoryCards
} else {
c.supply = 10
}
layout(c.name, keys[i])
}
for i, p := range players {
Expand Down

0 comments on commit 3a01d0d

Please sign in to comment.