Allow problem packs to have arbitrary sizes
This commit is contained in:
parent
3184ce476a
commit
e9e5ffdada
2 changed files with 7 additions and 7 deletions
|
@ -57,10 +57,10 @@ const (
|
||||||
type I8PPool map[I8PType][]Card
|
type I8PPool map[I8PType][]Card
|
||||||
|
|
||||||
// MakeI8PCube takes an organized set of cards and sorts them into a draftable I8PCube
|
// MakeI8PCube takes an organized set of cards and sorts them into a draftable I8PCube
|
||||||
func MakeI8PCube(cards I8PPool, schema I8PSchema) *I8PCube {
|
func MakeI8PCube(cards I8PPool, schema I8PSchema, problemPackSize int) *I8PCube {
|
||||||
return &I8PCube{
|
return &I8PCube{
|
||||||
Main: makeMainSet(cards, schema),
|
Main: makeMainSet(cards, schema),
|
||||||
Problems: makeProblemSet(cards),
|
Problems: makeProblemSet(cards, problemPackSize),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ func makeMainSet(cards I8PPool, schema I8PSchema) (set *I8PSet) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeProblemSet(cards I8PPool) (set *I8PSet) {
|
func makeProblemSet(cards I8PPool, problemPackSize int) (set *I8PSet) {
|
||||||
set = &I8PSet{
|
set = &I8PSet{
|
||||||
Cards: I8PPool{
|
Cards: I8PPool{
|
||||||
I8PTypeProblem: cards[I8PTypeProblem],
|
I8PTypeProblem: cards[I8PTypeProblem],
|
||||||
|
@ -111,7 +111,7 @@ func makeProblemSet(cards I8PPool) (set *I8PSet) {
|
||||||
set.Schema = draft.PackSchema{
|
set.Schema = draft.PackSchema{
|
||||||
Slots: []draft.PackSlot{
|
Slots: []draft.PackSlot{
|
||||||
{
|
{
|
||||||
Amount: 12,
|
Amount: problemPackSize,
|
||||||
Provider: set.ProviderByType(I8PTypeProblem),
|
Provider: set.ProviderByType(I8PTypeProblem),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,7 +21,7 @@ func TestDraftI8PCube(t *testing.T) {
|
||||||
mlp.I8PTypeEntry: mockCards("e1", "e2", "e3", "e4", "e5"),
|
mlp.I8PTypeEntry: mockCards("e1", "e2", "e3", "e4", "e5"),
|
||||||
mlp.I8PTypeProblem: mockCards("P1", "P2"),
|
mlp.I8PTypeProblem: mockCards("P1", "P2"),
|
||||||
}
|
}
|
||||||
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
|
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
|
||||||
|
|
||||||
pack1 := draft.MakePack(cube.Main)
|
pack1 := draft.MakePack(cube.Main)
|
||||||
pack2 := draft.MakePack(cube.Main)
|
pack2 := draft.MakePack(cube.Main)
|
||||||
|
@ -57,7 +57,7 @@ func TestDryCube(t *testing.T) {
|
||||||
mlp.I8PTypeMulti: mockCards("m1", "m4"),
|
mlp.I8PTypeMulti: mockCards("m1", "m4"),
|
||||||
mlp.I8PTypeEntry: mockCards("e1", "e4"),
|
mlp.I8PTypeEntry: mockCards("e1", "e4"),
|
||||||
}
|
}
|
||||||
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
|
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
|
||||||
pack := draft.MakePack(cube.Main)
|
pack := draft.MakePack(cube.Main)
|
||||||
if len(pack) != 11 {
|
if len(pack) != 11 {
|
||||||
t.Fatalf("Expected 11 cards in pack but got %d", len(pack))
|
t.Fatalf("Expected 11 cards in pack but got %d", len(pack))
|
||||||
|
@ -93,7 +93,7 @@ func TestPodI8PCube(t *testing.T) {
|
||||||
"Q9", "Q10", "Q11", "Q12",
|
"Q9", "Q10", "Q11", "Q12",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
|
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
|
||||||
|
|
||||||
remainingStart := i8pCountRemaining(cube)
|
remainingStart := i8pCountRemaining(cube)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue