Allow problem packs to have arbitrary sizes
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Hamcha 2019-07-01 14:41:42 +02:00
parent 3184ce476a
commit e9e5ffdada
2 changed files with 7 additions and 7 deletions

View File

@ -57,10 +57,10 @@ const (
type I8PPool map[I8PType][]Card
// 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{
Main: makeMainSet(cards, schema),
Problems: makeProblemSet(cards),
Problems: makeProblemSet(cards, problemPackSize),
}
}
@ -102,7 +102,7 @@ func makeMainSet(cards I8PPool, schema I8PSchema) (set *I8PSet) {
return
}
func makeProblemSet(cards I8PPool) (set *I8PSet) {
func makeProblemSet(cards I8PPool, problemPackSize int) (set *I8PSet) {
set = &I8PSet{
Cards: I8PPool{
I8PTypeProblem: cards[I8PTypeProblem],
@ -111,7 +111,7 @@ func makeProblemSet(cards I8PPool) (set *I8PSet) {
set.Schema = draft.PackSchema{
Slots: []draft.PackSlot{
{
Amount: 12,
Amount: problemPackSize,
Provider: set.ProviderByType(I8PTypeProblem),
},
},

View File

@ -21,7 +21,7 @@ func TestDraftI8PCube(t *testing.T) {
mlp.I8PTypeEntry: mockCards("e1", "e2", "e3", "e4", "e5"),
mlp.I8PTypeProblem: mockCards("P1", "P2"),
}
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
pack1 := draft.MakePack(cube.Main)
pack2 := draft.MakePack(cube.Main)
@ -57,7 +57,7 @@ func TestDryCube(t *testing.T) {
mlp.I8PTypeMulti: mockCards("m1", "m4"),
mlp.I8PTypeEntry: mockCards("e1", "e4"),
}
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
pack := draft.MakePack(cube.Main)
if len(pack) != 11 {
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",
),
}
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema())
cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12)
remainingStart := i8pCountRemaining(cube)