This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean test(List<Card> cards) { | |
if (cards == null || isStraightFlush.test(cards)) { | |
return false; | |
} | |
Map<Suit, Integer> sortedCards = cards.stream() | |
.map(Card::suit) | |
.collect(Collectors.toMap(Function.identity(), s -> 1, Integer::sum)); | |
return sortedCards.values().stream() | |
.anyMatch(count -> count >= 5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean test(List<Card> cards) { | |
if (cards == null || isStraightFlush.test(cards)) { | |
return false; | |
} | |
List<Card> sortedCards = cards.stream() | |
.sorted(Comparator.comparing(Card::suit)) | |
.toList(); | |
int suitsInARow = 1; | |
Suit lastSuit = null; | |
for (Card card : sortedCards) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Alert on interesting events - tcec-chess.com | |
// @namespace Violentmonkey Scripts | |
// @match https://tcec-chess.com/ | |
// @grant none | |
// @version 1.0 | |
// @author M.C.S. | |
// @description Plays a sound when the boards becomes somewhat interesting, i.e. one engine rates |eval| > 1 or both engines see different positional leaders | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
int a = 10; | |
if ((a == 10) && (a += 20) == 30) { | |
System.out.println("a = " + a); // should print 30 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a log wrapper for browser console. If console.log is defined, it passed the function arguments to it. | |
* Using this method prevents problems when using console.log directly in IE (at least in version 8). | |
*/ | |
var logger = function () { | |
if (console && console.log) { | |
console.log.call(console, arguments); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.assertEquals; | |
import java.text.SimpleDateFormat; | |
import java.util.Arrays; | |
import java.util.Date; | |
import java.util.TimeZone; | |
import org.junit.Test; | |
public class ParseDateTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package learning_tests; | |
import static org.custommonkey.xmlunit.XMLAssert.*; | |
import org.custommonkey.xmlunit.XMLUnit; | |
import org.junit.Test; | |
public class XmlUnitTest { | |
@Test |