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
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): |
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
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] | |
} | |
} |
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
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 |
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
[{ | |
active = 1; | |
awayTeamId = 8263028; | |
awayTeamName = { | |
en = "Molleker, Rudolf"; | |
ru = "Molleker, Rudolf"; | |
}; | |
baseOddsTemplate = { | |
handicap = { | |
isSpecialValue = 1; |
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
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) |
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
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) |
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
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) { |
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
[["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, |
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
["matchMap": { | |
15174521 = { | |
active = 1; | |
awayTeamId = 6731915; | |
awayTeamName = { | |
en = "Noel, Mallaurie"; | |
ru = "\U041d\U043e\U044d\U043b\U044c, \U041c\U0430\U043b\U0430\U0440\U0438"; | |
}; | |
baseOddsTemplate = { | |
handicap = { |
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
["matchMap": { | |
15173663 = { | |
active = 1; | |
awayTeamId = 8058533; | |
awayTeamName = { | |
en = "Kuznetsova, Aleksandra"; | |
ru = "Kuznetsova, Aleksandra"; | |
}; | |
baseOddsTemplate = { | |
handicap = { |