Skip to content

Instantly share code, notes, and snippets.

View JaDenis's full-sized avatar

Denis Zhabbarov JaDenis

View GitHub Profile
["matchMap": {
15173663 = {
active = 1;
awayTeamId = 8058533;
awayTeamName = {
en = "Kuznetsova, Aleksandra";
ru = "Kuznetsova, Aleksandra";
};
baseOddsTemplate = {
handicap = {
["matchMap": {
15174521 = {
active = 1;
awayTeamId = 6731915;
awayTeamName = {
en = "Noel, Mallaurie";
ru = "\U041d\U043e\U044d\U043b\U044c, \U041c\U0430\U043b\U0430\U0440\U0438";
};
baseOddsTemplate = {
handicap = {
[["oddTypeName": "Тотал", "outComeDescription": Меньше, "typeId": 5, "statusUpdateTime": 2018-07-27T16:22:08.000Z, "status": 1, "outCome": u, "coefficient": 3.1, "subTypeId": 0, "service": live, "freeText": , "matchId": 14990895, "disabled": 0, "specialValue": 1.5, "specialValueDescription": 1.5], ["oddTypeName": "Тотал", "outComeDescription": Больше, "typeId": 5, "statusUpdateTime": 2018-07-27T16:22:08.000Z, "status": 1, "outCome": o, "coefficient": 1.25, "subTypeId": 0, "service": live, "freeText": , "matchId": 14990895, "disabled": 0, "specialValue": 1.5, "specialValueDescription": 1.5], ["oddTypeName": "Тотал", "outComeDescription": Меньше, "typeId": 5, "statusUpdateTime": 2018-07-27T16:22:08.000Z, "status": 1, "outCome": u, "coefficient": 1.75, "subTypeId": 0, "service": live, "freeText": , "matchId": 14990895, "disabled": 0, "specialValue": 2.5, "specialValueDescription": 2.5], ["oddTypeName": "Тотал", "outComeDescription": Больше, "typeId": 5, "statusUpdateTime": 2018-07-27T16:22:08.000Z, "status": 1,
fun calcWinningPair(odds: List<Map<String, Any>>) : Map<Float, List<Map<String, Any>>> {
if (!odds.isEmpty()) {
var map: Map<Float, Any> = mapOf()
var absSpecialValues: List<Float> = listOf()
// print(odds)
odds.forEach {
val specialValue = it["specialValue"] as! String
val floatSpecialValue = Float(specialValue)
if (floatSpecialValue != null) {
func calcWinningPair(odds: [[String: Any]]) -> [Float : [[String : Any]]] {
if !odds.isEmpty {
var handicapMap: [Float: Any] = [:]
var absSpecialValues: [Float] = []
// print(odds)
odds.forEach {
let specialValue = $0["specialValue"] as! String
if let floatSpecialValue = Float(specialValue) {
let absSpecValue = abs(floatSpecialValue)
func calcWinningPair(odds: [[String: Any]]) -> [[String: Any]] {
var handicapMap: [Float: Any] = [:]
var absSpecialValues: [Float] = []
odds.forEach {
let specialValue = $0["specialValue"] as! String
if let floatSpecialValue = Float(specialValue) {
let absSpecValue = abs(floatSpecialValue)
absSpecialValues.append(absSpecValue)
[{
active = 1;
awayTeamId = 8263028;
awayTeamName = {
en = "Molleker, Rudolf";
ru = "Molleker, Rudolf";
};
baseOddsTemplate = {
handicap = {
isSpecialValue = 1;
for outCome in outComeOrder {
if let oddItem = outComeMap[outCome] as? NSDictionary {
var handicapOddItem: [String: Any] = [:]
if name == "handicap" {
print("--- handicap odd ---")
print(oddItem)
for key in oddItem.allKeys {
if key as! String == "outCome" {
handicapOddItem[key as! String] = const.string.handicapOdd + outCome
if name == "handicap" {
print("--- handicap odd ---")
print(oddItem)
for key in oddItem.allKeys {
if key as! String == "outCome" {
handicapOddItem[key as! String] = const.string.handicapOdd + outCome
} else {
handicapOddItem[key as! String] = oddItem[key]
}
}
@JaDenis
JaDenis / Luhn.swift
Created September 1, 2016 14:55 — forked from cwagdev/Luhn.swift
Luhn Algorithm in Swift
func luhnCheck(number: String) -> Bool {
var sum = 0
let digitStrings = reverse(number).map { String($0) }
for tuple in enumerate(digitStrings) {
if let digit = tuple.element.toInt() {
let odd = tuple.index % 2 == 1
switch (odd, digit) {
case (true, 9):