Created
September 7, 2014 17:33
-
-
Save lfaoro/8905fa255e26f8d79e85 to your computer and use it in GitHub Desktop.
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
let letters = ["0", "a", "b", "c", "d", "e", "f", "g", "h"] | |
let numbers = ["0", "1","2","3","4","5","6","7","8"] | |
func position(column: Int, row: Int) -> String { | |
if (column < letters.startIndex || column > letters.count) { | |
return "The board accepts onlynumbers from 1 to 8" | |
}else if (row < numbers.startIndex || row > numbers.count){ | |
return "The board accepts onlynumbers from 1 to 8" | |
} | |
var pieceAtColumn = letters[column] | |
var pieceAtRow = numbers[row] | |
let piecePosition = pieceAtColumn + pieceAtRow | |
return piecePosition | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment