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
extension Collection { | |
func chunk(size: Int) -> ChunkedCollection<Self> { | |
ChunkedCollection(self, size: size) | |
} | |
} | |
struct ChunkedCollection<Base: Collection>: Collection { | |
private let base: Base | |
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 CoreGraphics | |
public extension CGRect { | |
func subtract(_ subtrahend: CGRect, edge: CGRectEdge) -> CGRect { | |
guard intersects(subtrahend) else { return self } | |
let intersectSize: CGSize = intersection(subtrahend).size | |
let distance: CGFloat = (edge == .minXEdge || edge == .maxXEdge) |
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
//scroll down for statistical analysis | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map.Entry; | |
public class BulgarianSolitairePlayer{ | |
static List<Integer> moves = new ArrayList<Integer>(); |