Skip to content

Instantly share code, notes, and snippets.

@quintenpalmer
Last active August 26, 2018 02:21
Show Gist options
  • Save quintenpalmer/bd298db308f920fd093caf832fc74bfa to your computer and use it in GitHub Desktop.
Save quintenpalmer/bd298db308f920fd093caf832fc74bfa to your computer and use it in GitHub Desktop.

Number of cards: 0

duchy duke victory_points
0 0 0

Number of cards: 1

duchy duke victory_points
0 1 0
1 0 3

Number of cards: 2

duchy duke victory_points
0 2 0
1 1 4
2 0 6

Number of cards: 3

duchy duke victory_points
0 3 0
1 2 5
2 1 8
3 0 9

Number of cards: 4

duchy duke victory_points
0 4 0
1 3 6
2 2 10
3 1 12
4 0 12

Number of cards: 5

duchy duke victory_points
0 5 0
1 4 7
2 3 12
3 2 15
4 1 16
5 0 15

Number of cards: 6

duchy duke victory_points
0 6 0
1 5 8
2 4 14
3 3 18
4 2 20
5 1 20
6 0 18

Number of cards: 7

duchy duke victory_points
0 7 0
1 6 9
2 5 16
3 4 21
4 3 24
5 2 25
6 1 24
7 0 21

Number of cards: 8

duchy duke victory_points
0 8 0
1 7 10
2 6 18
3 5 24
4 4 28
5 3 30
6 2 30
7 1 28
8 0 24

Number of cards: 9

duchy duke victory_points
0 9 0
1 8 11
2 7 20
3 6 27
4 5 32
5 4 35
6 3 36
7 2 35
8 1 32
9 0 27

Number of cards: 10

duchy duke victory_points
0 10 0
1 9 12
2 8 22
3 7 30
4 6 36
5 5 40
6 4 42
7 3 42
8 2 40
9 1 36
10 0 30

Number of cards: 11

duchy duke victory_points
0 11 0
1 10 13
2 9 24
3 8 33
4 7 40
5 6 45
6 5 48
7 4 49
8 3 48
9 2 45
10 1 40
11 0 33

Number of cards: 12

duchy duke victory_points
0 12 0
1 11 14
2 10 26
3 9 36
4 8 44
5 7 50
6 6 54
7 5 56
8 4 56
9 3 54
10 2 50
11 1 44
12 0 36

Number of cards: 13

duchy duke victory_points
0 13 0
1 12 15
2 11 28
3 10 39
4 9 48
5 8 55
6 7 60
7 6 63
8 5 64
9 4 63
10 3 60
11 2 55
12 1 48
13 0 39

Number of cards: 14

duchy duke victory_points
0 14 0
1 13 16
2 12 30
3 11 42
4 10 52
5 9 60
6 8 66
7 7 70
8 6 72
9 5 72
10 4 70
11 3 66
12 2 60
13 1 52
14 0 42
struct Collection {
dukes: u32,
duchies: u32,
}
impl Collection {
fn value(&self) -> u32 {
return (self.duchies * 3) + (self.dukes * self.duchies);
}
}
fn main() {
for i in 0..15 {
println!("# Number of cards: {}", i);
println!("");
println!("duchy|duke|victory_points");
println!("------|----|--------------");
for j in 0..i + 1 {
println!(
"{}|{}|{}",
j,
i - j,
Collection {
duchies: j,
dukes: i - j,
}.value()
);
}
println!("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment