Advertisement
KonstantyNil

Untitled

Jul 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.79 KB | None | 0 0
  1. enum Color: String {
  2.     case white = "белый"
  3.     case black = "черный"
  4. }
  5.  
  6. enum ChessFigures: String {
  7.     case king = "король"
  8.     case queen = "королева"
  9.     case bishop = "слон"
  10.     case knight = "конь"
  11.     case rook = "ладья"
  12.     case pawn = "пешка"
  13. }
  14.  
  15. struct Chessmen {
  16.     var chessFigure: ChessFigures
  17.     var color: Color
  18.     var coordinates: (Character, UInt)? = nil
  19.    
  20.     mutating func setCoordinates(char: Character, num: UInt) {
  21.         self.coordinates = setCoordinates
  22.     }
  23.    
  24.     init(chessFigure: ChessFigures, color: Color) {
  25.         self.chessFigure = chessFigure
  26.         self.color = color
  27.        }
  28. }
  29.  
  30. var whiteKing = Chessmen(chessFigure: .king, color: .white)
  31. whiteKing.coordinates = ("A",4)
  32. whiteKing.coordinates
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement