trackler 2.2.1.148 → 2.2.1.149

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbab684afe326ddd909b3361ba000477a186b627
4
- data.tar.gz: 883862a6b7800c61b5210346f40e031c68058c69
3
+ metadata.gz: 42008f25c06e6b05e9f0ec0cba67f543bca6dbb1
4
+ data.tar.gz: f39be98e422e1df1bfc7ce5d221c7190e22ab4c8
5
5
  SHA512:
6
- metadata.gz: 2643b2729030dfedb42b4305ef9e42ff4de1c628f753ff56ae9beb5dc44b71116013f4489396b202ce103c5e62bb0f12334af8fde4305ab60548dc4e5f0d2172
7
- data.tar.gz: 74c5a67d7a337e2f26c9069634a19eb6804156c3c501b3e5b80d7460eb0fc3da0feb34e20ca2d3728da8c59318c5c652d013e4bb95599fa104e8b731218dddae
6
+ metadata.gz: f64e08b7041c734026adbb3034e64aadd14bc5eb666168b358f60ff158f6476326b788d1df596e8afa0f72eb5a98e8d81cf37ba4fb9dc741fc18cd9a47f6e8eb
7
+ data.tar.gz: 30293b1538d99bdcd9fc29a0676a31b5a7817af48f1413c2582babcc0548e2bd7ed4c76edd1bc3bbc8de7bbbc7eae5db8133af063450f1a33978ae30d197edfc
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.148"
2
+ VERSION = "2.2.1.149"
3
3
  end
@@ -1,2 +1,3 @@
1
- Given a string containing brackets `[]`, braces `{}` and parentheses `()`,
2
- verify that all the pairs are matched and nested correctly.
1
+ Given a string containing brackets `[]`, braces `{}`, parentheses `()`,
2
+ or any combination thereof, verify that any and all pairs are matched
3
+ and nested correctly.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "forth",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "comments": [
5
5
  "The cases are split into multiple sections, all with the same structure.",
6
6
  "In all cases, the `expected` key is the resulting stack",
@@ -364,6 +364,31 @@
364
364
  },
365
365
  "expected": [12]
366
366
  },
367
+ {
368
+ "description": "can use different words with the same name",
369
+ "property": "evaluate",
370
+ "input": {
371
+ "instructions": [
372
+ ": foo 5 ;",
373
+ ": bar foo ;",
374
+ ": foo 6 ;",
375
+ "bar foo"
376
+ ]
377
+ },
378
+ "expected": [5, 6]
379
+ },
380
+ {
381
+ "description": "can define word that uses word with the same name",
382
+ "property": "evaluate",
383
+ "input": {
384
+ "instructions": [
385
+ ": foo 10 ;",
386
+ ": foo foo 1 + ;",
387
+ "foo"
388
+ ]
389
+ },
390
+ "expected": [11]
391
+ },
367
392
  {
368
393
  "description": "cannot redefine numbers",
369
394
  "property": "evaluate",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "list-ops",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "comments": [
5
5
  "Though there are no specifications here for dealing with large lists,",
6
6
  "implementers may add tests for handling large lists to ensure that the",
@@ -40,7 +40,7 @@
40
40
  ]
41
41
  },
42
42
  {
43
- "description": "concat lists and lists of list into a new list",
43
+ "description": "concatenate a list of lists",
44
44
  "cases": [
45
45
  {
46
46
  "description": "empty list",
@@ -57,6 +57,14 @@
57
57
  "lists": [[1, 2], [3], [], [4, 5, 6]]
58
58
  },
59
59
  "expected": [1, 2, 3, 4, 5, 6]
60
+ },
61
+ {
62
+ "description": "list of nested lists",
63
+ "property": "concat",
64
+ "input": {
65
+ "lists": [[[1], [2]], [[3]], [[]], [[4, 5, 6]]]
66
+ },
67
+ "expected": [[1], [2], [3], [], [4, 5, 6]]
60
68
  }
61
69
  ]
62
70
  },
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
6
6
 
7
7
  He answers 'Whoa, chill out!' if you yell at him.
8
8
 
9
+ He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
10
+
9
11
  He says 'Fine. Be that way!' if you address him without actually saying
10
12
  anything.
11
13
 
@@ -1,7 +1,8 @@
1
1
  # Bracket Push
2
2
 
3
- Given a string containing brackets `[]`, braces `{}` and parentheses `()`,
4
- verify that all the pairs are matched and nested correctly.
3
+ Given a string containing brackets `[]`, braces `{}`, parentheses `()`,
4
+ or any combination thereof, verify that any and all pairs are matched
5
+ and nested correctly.
5
6
 
6
7
  ## Testing
7
8
 
@@ -9,6 +9,14 @@
9
9
  "unlocked_by": null,
10
10
  "uuid": "c4fdc935-885b-44bd-84e4-fae4a09e8c39"
11
11
  },
12
+ {
13
+ "core": false,
14
+ "difficulty": 1,
15
+ "slug": "two-fer",
16
+ "topics": null,
17
+ "unlocked_by": null,
18
+ "uuid": "36e5dc3a-2122-484a-ae82-beb7b813e2cd"
19
+ },
12
20
  {
13
21
  "core": false,
14
22
  "difficulty": 1,
@@ -176,6 +184,14 @@
176
184
  "topics": null,
177
185
  "unlocked_by": null,
178
186
  "uuid": "a252e137-8a63-4f26-b119-7264f12a257a"
187
+ },
188
+ {
189
+ "core": false,
190
+ "difficulty": 1,
191
+ "slug": "armstrong-numbers",
192
+ "topics": null,
193
+ "unlocked_by": null,
194
+ "uuid": "059141f0-f28d-4d10-a03a-7852dbfc2d2e"
179
195
  }
180
196
  ],
181
197
  "foregone": [],
@@ -0,0 +1,19 @@
1
+ ## Armstrong numbers
2
+
3
+ An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
4
+
5
+ For example:
6
+
7
+ - 9 is an Armstrong number, because `9 = 9^1 = 9`
8
+ - 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
9
+ - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
10
+ - 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
11
+
12
+ Write some code to determine whether a number is an Armstrong number.
13
+
14
+ ## Source
15
+
16
+ See more at [wikipedia](https://en.wikipedia.org/wiki/Narcissistic_number)
17
+
18
+ ## Submitting Incomplete Solutions
19
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,41 @@
1
+ ;;; armstrong-numbers-test.el --- Tests for armstrong-numbers (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+ (load-file "armstrong-numbers.el")
8
+
9
+ (ert-deftest armstrong-number-5 ()
10
+ "Single digit numbers are Armstrong numbers"
11
+ (should (armstrong-p 5)))
12
+
13
+ (ert-deftest not-armstrong-number-10 ()
14
+ "There are no 2 digit Armstrong numbers"
15
+ (should (not (armstrong-p 10))))
16
+
17
+ (ert-deftest armstrong-number-153 ()
18
+ "Three digit number that should an Armstrong number"
19
+ (should (armstrong-p 153)))
20
+
21
+ (ert-deftest not-armstrong-number-100 ()
22
+ "Three digit number that should an Armstrong number"
23
+ (should (not (armstrong-p 100))))
24
+
25
+ (ert-deftest armstrong-number-9474 ()
26
+ "Four digit number that should an Armstrong number"
27
+ (should (armstrong-p 9474)))
28
+
29
+ (ert-deftest not-armstrong-number-9475 ()
30
+ "Four digit number that should not an Armstrong number"
31
+ (should (not (armstrong-p 9476))))
32
+
33
+ (ert-deftest armstrong-number-9926315 ()
34
+ "Seven digit number that should an Armstrong number"
35
+ (should (armstrong-p 9926315)))
36
+
37
+ (ert-deftest not-armstrong-number-9926314 ()
38
+ "Seven digit number that should not an Armstrong number"
39
+ (should (not (armstrong-p 9926314))))
40
+
41
+ ;;; armstrong-numbers-test.el ends here
@@ -0,0 +1,8 @@
1
+ ;;; armstrong-numbers.el --- armstrong-numbers Exercise (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+ (provide 'armstrong-numbers)
8
+ ;;; armstrong-numbers.el ends here
@@ -0,0 +1,13 @@
1
+ ;;; armstrong-numbers.el --- armstrong-numbers Exercise (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+ (defun armstrong-p (n)
8
+ (let* ((digits (mapcar #'(lambda (d) (- d ?0)) (string-to-list (int-to-string n))))
9
+ (p (length digits)))
10
+ (= n (apply '+ (mapcar #'(lambda (d) (expt d p)) digits)))))
11
+
12
+ (provide 'armstrong-numbers)
13
+ ;;; armstrong-numbers.el ends here
@@ -4,10 +4,8 @@
4
4
 
5
5
  ;;; Code:
6
6
 
7
- (defun hello (&optional name)
8
- "Say hello, optionally to NAME."
9
- (let ((greetee (or name "World")))
10
- (concat "Hello, " greetee "!")))
7
+ (defun hello ()
8
+ "Hello, World!")
11
9
 
12
10
  (provide 'hello-world)
13
11
  ;;; hello-world.el ends here
@@ -1,18 +1,15 @@
1
1
  ;;; hello-world-test.el --- Tests for Hello World (exercism)
2
2
 
3
3
  ;;; Commentary:
4
+ ;; Common test data version: 1.1.0 be3ae66
4
5
 
5
6
  ;;; Code:
6
7
 
7
8
  (load-file "hello-world.el")
8
9
 
9
- (ert-deftest no-args ()
10
+ (ert-deftest hello-world-test ()
10
11
  (should (equal (hello) "Hello, World!")))
11
12
 
12
- (ert-deftest with-args ()
13
- (should (equal (hello "Emacs") "Hello, Emacs!"))
14
- (should (equal (hello "Exercism") "Hello, Exercism!")))
15
-
16
13
  (provide 'hello-world-test)
17
14
 
18
15
  ;;; hello-world-test.el ends here
@@ -0,0 +1,19 @@
1
+ # Two Fer
2
+
3
+ `Two-fer` or `2-fer` is short for two for one. One for you and one for me.
4
+
5
+ ```text
6
+ "One for X, one for me."
7
+ ```
8
+
9
+ When X is a name or "you".
10
+
11
+ If the given name is "Alice", the result should be "One for Alice, one for me."
12
+ If no name is given, the result should be "One for you, one for me."
13
+
14
+ ## Source
15
+
16
+ [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
17
+
18
+ ## Submitting Incomplete Solutions
19
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,13 @@
1
+ ;;; two-fer.el --- Two-fer Exercise (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+ (defun two-fer (&optional name)
8
+ (let ((player (or name "you")))
9
+ (concat "One for " player ", one for me.")))
10
+
11
+ (provide 'two-fer)
12
+
13
+ ;;; two-fer.el ends here
@@ -0,0 +1,21 @@
1
+ ;;; two-fer-test.el --- Tests for Two-fer (exercism)
2
+
3
+ ;;; Commentary:
4
+ ;; Common test data version: 1.2.0 4fc1acb
5
+
6
+ ;;; Code:
7
+
8
+ (load-file "two-fer.el")
9
+
10
+ (ert-deftest no-name-given ()
11
+ (should (equal (two-fer) "One for you, one for me.")))
12
+
13
+ (ert-deftest a-name-given ()
14
+ (should (equal (two-fer "Alice") "One for Alice, one for me.")))
15
+
16
+ (ert-deftest another-name-given ()
17
+ (should (equal (two-fer "Bob") "One for Bob, one for me.")))
18
+
19
+ (provide 'two-fer-test)
20
+
21
+ ;;; two-fer-test.el ends here
@@ -0,0 +1,9 @@
1
+ ;;; hello-world.el --- Hello World Exercise (exercism)
2
+
3
+ ;;; Commentary:
4
+
5
+ ;;; Code:
6
+
7
+
8
+ (provide 'hello-world)
9
+ ;;; hello-world.el ends here
@@ -16,10 +16,13 @@ class Card {
16
16
  }
17
17
 
18
18
  private int parseRank(String card) {
19
- return "..23456789TJQKA".indexOf(card.charAt(0));
19
+ if (card.substring(0, 2).equals("10")) {
20
+ return 10;
21
+ }
22
+ return "..23456789TJQKA".indexOf(card.charAt(0));
20
23
  }
21
24
 
22
25
  private int parseSuit(String card) {
23
- return ".HSDC".indexOf(card.charAt(1));
26
+ return ".HSDC".indexOf(card.charAt(card.length() - 1));
24
27
  }
25
28
  }
@@ -38,10 +38,9 @@ class Hand {
38
38
  }
39
39
  return frequencyMap;
40
40
  }
41
-
41
+
42
42
  private int scoreHand(List<Card> cards) {
43
- List<Card> cardsByRank = cards
44
- .stream()
43
+ List<Card> cardsByRank = cards.stream()
45
44
  .sorted(Comparator.comparing(Card::getRank))
46
45
  .unordered()
47
46
  .collect(Collectors.toList());
@@ -63,7 +62,10 @@ class Hand {
63
62
  .stream()
64
63
  .map(Map.Entry::getValue)
65
64
  .collect(Collectors.toList());
66
- List<Integer> suits = cards.stream().map(Card::getSuit).collect(Collectors.toList());
65
+ List<Integer> suits = cards
66
+ .stream()
67
+ .map(Card::getSuit)
68
+ .collect(Collectors.toList());
67
69
 
68
70
  return calculatedScore(frequencyMap, cardsByRank, ranks, rankCounts, suits);
69
71
  }
@@ -74,9 +76,15 @@ class Hand {
74
76
  ranks = Arrays.asList(5, 4, 3, 2, 1);
75
77
  }
76
78
 
77
- boolean flush = suits.stream().distinct().count() == 1;
78
- boolean straight = ranks.stream().distinct().count() == 5 && ranks.get(0) - ranks.get(4) == 4;
79
+ boolean flush = suits
80
+ .stream()
81
+ .distinct()
82
+ .count() == 1;
83
+ boolean straight = ranks.stream().distinct().count() == 5
84
+ && ranks.get(0) - ranks.get(4) == 4;
85
+
79
86
  Iterator<Integer> iteratorOverFrequencies = frequencyMap.keySet().iterator();
87
+
80
88
  int highestFrequency = iteratorOverFrequencies.next();
81
89
 
82
90
  if (straight && flush) {
@@ -86,24 +94,55 @@ class Hand {
86
94
  return 700 + cardsByRank.get(0).getRank();
87
95
  }
88
96
  if (rankCounts.equals(Arrays.asList(3, 2))) {
89
- return 600 + cardsByRank.get(0).getRank();
97
+ int triplet = 0;
98
+ int pair = 0;
99
+ for (Integer key : frequencyMap.keySet()) {
100
+ if (frequencyMap.get(key) == 2) {
101
+ pair = (int) key;
102
+ }
103
+ if (frequencyMap.get(key) == 3) {
104
+ triplet = 3 * (int) key;
105
+ }
106
+ }
107
+ return 600 + 3 * triplet + pair;
90
108
  }
91
109
  if (flush) {
92
110
  return 500 + highestFrequency;
93
111
  }
94
112
  if (straight) {
95
- return 400 + highestFrequency;
113
+ int maxValue = Collections.max(ranks);
114
+ return 400 + maxValue;
96
115
  }
97
116
  if (rankCounts.equals(Arrays.asList(3, 1, 1))) {
98
- return 300 + cardsByRank.get(0).getRank();
117
+ List<Integer> uniqueCards = new ArrayList<Integer>();
118
+ int triplet = 0;
119
+ for (Integer key : frequencyMap.keySet()) {
120
+ if (frequencyMap.get(key) == 1) {
121
+ uniqueCards.add((int) key);
122
+ }
123
+ if (frequencyMap.get(key) == 3) {
124
+ triplet = 3 * (int) key;
125
+ }
126
+ }
127
+ return 300 + triplet + Collections.max(uniqueCards);
99
128
  }
100
129
  if (rankCounts.equals(Arrays.asList(2, 2, 1))) {
101
- return 200 + Math.max(highestFrequency, iteratorOverFrequencies.next());
130
+ int productsOfFrequencyAndValue = 0;
131
+ for (Integer key : frequencyMap.keySet()) {
132
+ int frequencyKey = (int) key;
133
+ int frequencyValue = frequencyMap.get(key);
134
+ productsOfFrequencyAndValue += frequencyKey * frequencyValue;
135
+ }
136
+ return 200 + productsOfFrequencyAndValue + 2 * Math.max(highestFrequency, iteratorOverFrequencies.next());
102
137
  }
103
138
  if (rankCounts.equals(Arrays.asList(2, 1, 1, 1))) {
104
139
  return 100 + highestFrequency;
105
140
  }
106
141
  ranks.sort(Comparator.naturalOrder());
107
- return ranks.get(0);
142
+ int result = 0;
143
+ for (int i = 0; i < ranks.size(); i++) {
144
+ result += ranks.get(0) * (i + 1);
145
+ }
146
+ return result + ranks.get(ranks.size() - 1);
108
147
  }
109
- }
148
+ }
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -2,6 +2,7 @@ import org.junit.Ignore;
2
2
  import org.junit.Test;
3
3
 
4
4
  import java.util.Arrays;
5
+ import java.util.Collections;
5
6
 
6
7
  import static org.junit.Assert.assertEquals;
7
8
 
@@ -9,99 +10,174 @@ public class PokerTest {
9
10
  @Test
10
11
  public void oneHand() {
11
12
  String hand = "4S 5S 7H 8D JC";
12
- assertEquals(Arrays.asList(hand), new Poker(Arrays.asList(hand)).getBestHands());
13
+ assertEquals(Collections.singletonList(hand), new Poker(Collections.singletonList(hand)).getBestHands());
14
+ }
15
+
16
+ @Ignore("Remove to run test")
17
+ @Test
18
+ public void highestCardWins() {
19
+ String highest8 = "4D 5S 6S 8D 3C";
20
+ String highest10 = "2S 4C 7S 9H 10H";
21
+ String highestJ = "3S 4S 5D 6H JH";
22
+ assertEquals(Collections.singletonList(highestJ), new Poker(Arrays.asList(highest8, highest10, highestJ)).getBestHands());
23
+ }
24
+
25
+ @Ignore("Remove to run test")
26
+ @Test
27
+ public void tieHasMultipleWinners() {
28
+ String highest8 = "4D 5S 6S 8D 3C";
29
+ String highest10 = "2S 4C 7S 9H 10H";
30
+ String highestJh = "3S 4S 5D 6H JH";
31
+ String highestJd = "3H 4H 5C 6C JD";
32
+ assertEquals(Arrays.asList(highestJh, highestJd),
33
+ new Poker(Arrays.asList(highest8, highest10, highestJh, highestJd)).getBestHands());
34
+ }
35
+
36
+ @Ignore("Remove to run test")
37
+ @Test
38
+ public void sameHighCards() {
39
+ String nextHighest3 = "3S 5H 6S 8D 7H";
40
+ String nextHighest2 = "2S 5D 6D 8C 7S";
41
+ assertEquals(Collections.singletonList(nextHighest3), new Poker(Arrays.asList(nextHighest3, nextHighest2)).getBestHands());
13
42
  }
14
43
 
15
44
  @Ignore("Remove to run test")
16
45
  @Test
17
46
  public void nothingVsOnePair() {
18
- String nothing = "4S 5H 6S 8D JH";
47
+ String nothing = "4S 5H 6C 8D KH";
19
48
  String pairOf4 = "2S 4H 6S 4D JH";
20
- assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(nothing, pairOf4)).getBestHands());
49
+ assertEquals(Collections.singletonList(pairOf4), new Poker(Arrays.asList(nothing, pairOf4)).getBestHands());
21
50
  }
22
51
 
23
52
  @Ignore("Remove to run test")
24
53
  @Test
25
54
  public void twoPairs() {
26
55
  String pairOf2 = "4S 2H 6S 2D JH";
27
- String pairOf4 = "2S 4H 6S 4D JH";
28
- assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(pairOf2, pairOf4)).getBestHands());
56
+ String pairOf4 = "2S 4H 6C 4D JD";
57
+ assertEquals(Collections.singletonList(pairOf4), new Poker(Arrays.asList(pairOf2, pairOf4)).getBestHands());
29
58
  }
30
59
 
31
60
  @Ignore("Remove to run test")
32
61
  @Test
33
62
  public void onePairVsDoublePair() {
34
63
  String pairOf8 = "2S 8H 6S 8D JH";
35
- String doublePair = "4S 5H 4S 8D 5H";
36
- assertEquals(Arrays.asList(doublePair), new Poker(Arrays.asList(pairOf8, doublePair)).getBestHands());
64
+ String doublePair = "4S 5H 4C 8C 5C";
65
+ assertEquals(Collections.singletonList(doublePair), new Poker(Arrays.asList(pairOf8, doublePair)).getBestHands());
37
66
  }
38
67
 
39
68
  @Ignore("Remove to run test")
40
69
  @Test
41
70
  public void twoDoublePairs() {
42
- String doublePair2And8 = "2S 8H 2S 8D JH";
43
- String doublePair4And5 = "4S 5H 4S 8D 5H";
44
- assertEquals(Arrays.asList(doublePair2And8), new Poker(Arrays.asList(doublePair2And8, doublePair4And5)).getBestHands());
71
+ String doublePair2And8 = "2S 8H 2D 8D 3H";
72
+ String doublePair4And5 = "4S 5H 4C 8S 5D";
73
+ assertEquals(Collections.singletonList(doublePair2And8),
74
+ new Poker(Arrays.asList(doublePair2And8, doublePair4And5)).getBestHands());
75
+ }
76
+
77
+ @Ignore("Remove to run test")
78
+ @Test
79
+ public void sameHighestPair() {
80
+ String doublePair2AndQ = "2S QS 2C QD JH";
81
+ String doublePairJAndQ = "JD QH JS 8D QC";
82
+ assertEquals(Collections.singletonList(doublePairJAndQ),
83
+ new Poker(Arrays.asList(doublePairJAndQ, doublePair2AndQ)).getBestHands());
84
+ }
85
+
86
+ @Ignore("Remove to run test")
87
+ @Test
88
+ public void identicallyRankedPairs() {
89
+ String kicker8 = "JD QH JS 8D QC";
90
+ String kicker2 = "JS QS JC 2D QD";
91
+ assertEquals(Collections.singletonList(kicker8), new Poker(Arrays.asList(kicker8, kicker2)).getBestHands());
45
92
  }
46
93
 
47
94
  @Ignore("Remove to run test")
48
95
  @Test
49
96
  public void doublePairVsThree() {
50
- String doublePair2And8 = "2S 8H 2S 8D JH";
51
- String threeOf4 = "4S 5H 4S 8D 4H";
52
- assertEquals(Arrays.asList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands());
97
+ String doublePair2And8 = "2S 8H 2H 8D JH";
98
+ String threeOf4 = "4S 5H 4C 8S 4H";
99
+ assertEquals(Collections.singletonList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands());
53
100
  }
54
101
 
55
102
  @Ignore("Remove to run test")
56
103
  @Test
57
104
  public void twoThrees() {
58
- String threeOf2 = "2S 2H 2S 8D JH";
59
- String threeOf1 = "4S AH AS 8D AH";
60
- assertEquals(Arrays.asList(threeOf1), new Poker(Arrays.asList(threeOf2, threeOf1)).getBestHands());
105
+ String threeOf2 = "2S 2H 2C 8D JH";
106
+ String threeOf1 = "4S AH AS 8C AD";
107
+ assertEquals(Collections.singletonList(threeOf1), new Poker(Arrays.asList(threeOf2, threeOf1)).getBestHands());
108
+ }
109
+
110
+ @Ignore("Remove to run test")
111
+ @Test
112
+ public void sameThreesMultipleDecks() {
113
+ String remainingCard7 = "4S AH AS 7C AD";
114
+ String remainingCard8 = "4S AH AS 8C AD";
115
+ assertEquals(Collections.singletonList(remainingCard8),
116
+ new Poker(Arrays.asList(remainingCard7, remainingCard8)).getBestHands());
61
117
  }
62
118
 
63
119
  @Ignore("Remove to run test")
64
120
  @Test
65
121
  public void threeVsStraight() {
66
- String threeOf4 = "4S 5H 4S 8D 4H";
67
- String straight = "3S 4H 2S 6D 5H";
68
- assertEquals(Arrays.asList(straight), new Poker(Arrays.asList(threeOf4, straight)).getBestHands());
122
+ String threeOf4 = "4S 5H 4C 8D 4H";
123
+ String straight = "3S 4D 2S 6D 5C";
124
+ assertEquals(Collections.singletonList(straight), new Poker(Arrays.asList(threeOf4, straight)).getBestHands());
125
+ }
126
+
127
+ @Ignore("Remove to run test")
128
+ @Test
129
+ public void AcesCanEndAStraight() {
130
+ String hand = "4S 5H 4C 8D 4H";
131
+ String straightEndsA = "10D JH QS KD AC";
132
+ assertEquals(Collections.singletonList(straightEndsA), new Poker(Arrays.asList(hand, straightEndsA)).getBestHands());
133
+ }
134
+
135
+ @Ignore("Remove to run test")
136
+ @Test
137
+ public void AcesCanStartAStraight() {
138
+ String hand = "4S 5H 4C 8D 4H";
139
+ String straightStartA = "4D AH 3S 2D 5C";
140
+ assertEquals(Collections.singletonList(straightStartA), new Poker(Arrays.asList(hand, straightStartA)).getBestHands());
69
141
  }
70
142
 
71
143
  @Ignore("Remove to run test")
72
144
  @Test
73
145
  public void twoStraights() {
74
- String straightTo8 = "4S 6H 7S 8D 5H";
146
+ String straightTo8 = "4S 6C 7S 8D 5H";
75
147
  String straightTo9 = "5S 7H 8S 9D 6H";
76
- assertEquals(Arrays.asList(straightTo9), new Poker(Arrays.asList(straightTo8, straightTo9)).getBestHands());
148
+ assertEquals(Collections.singletonList(straightTo9), new Poker(Arrays.asList(straightTo8, straightTo9)).getBestHands());
149
+ }
77
150
 
78
- String straightTo1 = "AS QH KS TD JH";
79
- String straightTo5 = "4S AH 3S 2D 5H";
80
- assertEquals(Arrays.asList(straightTo1), new Poker(Arrays.asList(straightTo1, straightTo5)).getBestHands());
151
+ @Ignore("Remove to run test")
152
+ @Test
153
+ public void theLowestStraightStartsWithAce() {
154
+ String straight = "2H 3C 4D 5D 6H";
155
+ String straightStartA = "4S AH 3S 2D 5H";
156
+ assertEquals(Collections.singletonList(straight), new Poker(Arrays.asList(straight, straightStartA)).getBestHands());
81
157
  }
82
158
 
83
159
  @Ignore("Remove to run test")
84
160
  @Test
85
161
  public void straightVsFlush() {
86
- String straightTo8 = "4S 6H 7S 8D 5H";
162
+ String straightTo8 = "4C 6H 7D 8D 5H";
87
163
  String flushTo7 = "2S 4S 5S 6S 7S";
88
- assertEquals(Arrays.asList(flushTo7), new Poker(Arrays.asList(straightTo8, flushTo7)).getBestHands());
164
+ assertEquals(Collections.singletonList(flushTo7), new Poker(Arrays.asList(straightTo8, flushTo7)).getBestHands());
89
165
  }
90
166
 
91
167
  @Ignore("Remove to run test")
92
168
  @Test
93
169
  public void twoFlushes() {
94
- String flushTo8 = "3H 6H 7H 8H 5H";
170
+ String flushTo8 = "4H 7H 8H 9H 6H";
95
171
  String flushTo7 = "2S 4S 5S 6S 7S";
96
- assertEquals(Arrays.asList(flushTo8), new Poker(Arrays.asList(flushTo8, flushTo7)).getBestHands());
172
+ assertEquals(Collections.singletonList(flushTo8), new Poker(Arrays.asList(flushTo8, flushTo7)).getBestHands());
97
173
  }
98
174
 
99
175
  @Ignore("Remove to run test")
100
176
  @Test
101
177
  public void flushVsFull() {
102
178
  String flushTo8 = "3H 6H 7H 8H 5H";
103
- String full = "4S 5H 4S 5D 4H";
104
- assertEquals(Arrays.asList(full), new Poker(Arrays.asList(full, flushTo8)).getBestHands());
179
+ String full = "4S 5H 4C 5D 4H";
180
+ assertEquals(Collections.singletonList(full), new Poker(Arrays.asList(full, flushTo8)).getBestHands());
105
181
  }
106
182
 
107
183
  @Ignore("Remove to run test")
@@ -109,55 +185,56 @@ public class PokerTest {
109
185
  public void twoFulls() {
110
186
  String fullOf4By9 = "4H 4S 4D 9S 9D";
111
187
  String fullOf5By8 = "5H 5S 5D 8S 8D";
112
- assertEquals(Arrays.asList(fullOf5By8), new Poker(Arrays.asList(fullOf4By9, fullOf5By8)).getBestHands());
188
+ assertEquals(Collections.singletonList(fullOf5By8), new Poker(Arrays.asList(fullOf4By9, fullOf5By8)).getBestHands());
113
189
  }
114
190
 
115
191
  @Ignore("Remove to run test")
116
192
  @Test
117
- public void fullVsSquare() {
118
- String full = "4S 5H 4S 5D 4H";
119
- String squareOf3 = "3S 3H 2S 3D 3H";
120
- assertEquals(Arrays.asList(squareOf3), new Poker(Arrays.asList(full, squareOf3)).getBestHands());
193
+ public void twoFullssameThripletMultipleDecks() {
194
+ String fullOf5By9 = "5H 5S 5D 9S 9D";
195
+ String fullOf5By8 = "5H 5S 5D 8S 8D";
196
+ assertEquals(Collections.singletonList(fullOf5By9), new Poker(Arrays.asList(fullOf5By9, fullOf5By8)).getBestHands());
121
197
  }
122
198
 
123
199
  @Ignore("Remove to run test")
124
200
  @Test
125
- public void twoSquares() {
126
- String squareOf2 = "2S 2H 2S 8D 2H";
127
- String squareOf5 = "4S 5H 5S 5D 5H";
128
- assertEquals(Arrays.asList(squareOf5), new Poker(Arrays.asList(squareOf2, squareOf5)).getBestHands());
201
+ public void fullVsSquare() {
202
+ String full = "4S 5H 4D 5D 4H";
203
+ String squareOf3 = "3S 3H 2S 3D 3C";
204
+ assertEquals(Collections.singletonList(squareOf3), new Poker(Arrays.asList(full, squareOf3)).getBestHands());
129
205
  }
130
206
 
131
207
  @Ignore("Remove to run test")
132
208
  @Test
133
- public void squareVsStraightFlush() {
134
- String squareOf5 = "4S 5H 5S 5D 5H";
135
- String straightFlushTo9 = "5S 7S 8S 9S 6S";
136
- assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(squareOf5, straightFlushTo9)).getBestHands());
209
+ public void twoSquares() {
210
+ String squareOf2 = "2S 2H 2C 8D 2D";
211
+ String squareOf5 = "4S 5H 5S 5D 5C";
212
+ assertEquals(Collections.singletonList(squareOf5), new Poker(Arrays.asList(squareOf2, squareOf5)).getBestHands());
137
213
  }
138
214
 
139
215
  @Ignore("Remove to run test")
140
216
  @Test
141
- public void twoStraightFlushes() {
142
- String straightFlushTo8 = "4H 6H 7H 8H 5H";
143
- String straightFlushTo9 = "5S 7S 8S 9S 6S";
144
- assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(straightFlushTo8, straightFlushTo9)).getBestHands());
217
+ public void sameSquaresMultipleDecks() {
218
+ String kicker2 = "3S 3H 2S 3D 3C";
219
+ String kicker4 = "3S 3H 4S 3D 3C";
220
+ assertEquals(Collections.singletonList(kicker4), new Poker(Arrays.asList(kicker2, kicker4)).getBestHands());
145
221
  }
146
222
 
147
223
  @Ignore("Remove to run test")
148
224
  @Test
149
- public void threeHandWithTie() {
150
- String spadeStraightTo9 = "9S 8S 7S 6S 5S";
151
- String diamondStraightTo9 = "9D 8D 7D 6D 5D";
152
- String threeOf4 = "4D 4S 4H QS KS";
153
- assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), new Poker(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)).getBestHands());
225
+ public void squareVsStraightFlush() {
226
+ String squareOf5 = "4S 5H 5S 5D 5C";
227
+ String straightFlushTo9 = "7S 8S 9S 6S 10S";
228
+ assertEquals(Collections.singletonList(straightFlushTo9),
229
+ new Poker(Arrays.asList(squareOf5, straightFlushTo9)).getBestHands());
154
230
  }
155
231
 
156
232
  @Ignore("Remove to run test")
157
233
  @Test
158
- public void straightTo5AgainstAPairOfJacks() {
159
- String straightTo5 = "2S 4D 5C 3S AS";
160
- String twoJacks = "JD 8D 7D JC 5D";
161
- assertEquals(Arrays.asList(straightTo5), new Poker(Arrays.asList(straightTo5, twoJacks)).getBestHands());
234
+ public void twoStraightFlushes() {
235
+ String straightFlushTo8 = "4H 6H 7H 8H 5H";
236
+ String straightFlushTo9 = "5S 7S 8S 9S 6S";
237
+ assertEquals(Collections.singletonList(straightFlushTo9),
238
+ new Poker(Arrays.asList(straightFlushTo8, straightFlushTo9)).getBestHands());
162
239
  }
163
240
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.148
4
+ version: 2.2.1.149
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -4081,6 +4081,10 @@ files:
4081
4081
  - tracks/elisp/exercises/anagram/anagram-test.el
4082
4082
  - tracks/elisp/exercises/anagram/anagram.el
4083
4083
  - tracks/elisp/exercises/anagram/example.el
4084
+ - tracks/elisp/exercises/armstrong-numbers/README.md
4085
+ - tracks/elisp/exercises/armstrong-numbers/armstrong-numbers-test.el
4086
+ - tracks/elisp/exercises/armstrong-numbers/armstrong-numbers.el
4087
+ - tracks/elisp/exercises/armstrong-numbers/example.el
4084
4088
  - tracks/elisp/exercises/atbash-cipher/README.md
4085
4089
  - tracks/elisp/exercises/atbash-cipher/atbash-cipher-test.el
4086
4090
  - tracks/elisp/exercises/atbash-cipher/atbash-cipher.el
@@ -4153,6 +4157,10 @@ files:
4153
4157
  - tracks/elisp/exercises/roman-numerals/example.el
4154
4158
  - tracks/elisp/exercises/roman-numerals/roman-numerals-test.el
4155
4159
  - tracks/elisp/exercises/roman-numerals/roman-numerals.el
4160
+ - tracks/elisp/exercises/two-fer/README.md
4161
+ - tracks/elisp/exercises/two-fer/example.el
4162
+ - tracks/elisp/exercises/two-fer/two-fer-test.el
4163
+ - tracks/elisp/exercises/two-fer/two-fer.el
4156
4164
  - tracks/elisp/exercises/word-count/README.md
4157
4165
  - tracks/elisp/exercises/word-count/example.el
4158
4166
  - tracks/elisp/exercises/word-count/word-count-test.el
@@ -7970,6 +7978,7 @@ files:
7970
7978
  - tracks/java/exercises/poker/.meta/src/reference/java/Card.java
7971
7979
  - tracks/java/exercises/poker/.meta/src/reference/java/Hand.java
7972
7980
  - tracks/java/exercises/poker/.meta/src/reference/java/Poker.java
7981
+ - tracks/java/exercises/poker/.meta/version.txt
7973
7982
  - tracks/java/exercises/poker/README.md
7974
7983
  - tracks/java/exercises/poker/build.gradle
7975
7984
  - tracks/java/exercises/poker/src/main/java/.keep