-
Notifications
You must be signed in to change notification settings - Fork 0
/
Secondlolidk.swift
118 lines (88 loc) · 3.81 KB
/
Secondlolidk.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//
// Secondlolidk.swift
// BlackjackReturns
//
// Created by Aamhish Rao on 5/30/16.
// Copyright © 2016 Aamhish Rao. All rights reserved.
//
import UIKit
class Secondlolidk: ViewController {
@IBOutlet weak var lolman: UILabel!
@IBOutlet weak var lolll: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
NSLog("lolmanlol")
}
@IBAction func lolidklolmanhahastand(sender: AnyObject) {
var botscore=0
while(botscore<15){
botscore+=Int(arc4random_uniform(10) + 2)
}
if(lolscore>21&&botscore>21){
lolman.text="BUSTED both of you"
// bruh.text="Restart?"
}
else if(lolscore>21){
lolman.text = "You were busted Bot won: "+String(botscore)
}
else if(botscore>21){
lolman.text = "Bot was busted You won! Bot score:"+String(botscore)
}
else if(lolscore==21){
lolman.text="You won! Botscore:"+String(botscore)
// bruh.text="Restart?"
}
else if(botscore==21){
lolman.text="Bot won! Botscore: "+String(botscore)
// bruh.text="Restart?"
}
else if(abs(21-lolscore)<abs(21-botscore)){
lolman.text="You won! Botscore:"+String(botscore)
}
else if(abs(21-lolscore)>abs(21-botscore)){
lolman.text=" Bot won Botscore"+String(botscore)
}
else{
NSLog("lol....")
lolman.text="tie Botscore:"+String(botscore) }
}
@IBAction func lolidkyourdadlol(sender: AnyObject) {
lolscore=0
lolll.text=""
lolman.text=""
lolhahalol.image=UIImage(named:"backofcard")
}
@IBOutlet weak var lolhahalol: UIImageView!
var lolscore = 0
@IBAction func lolidklol(sender: AnyObject) {
var drawloll = Int(arc4random_uniform(10) + 2)
if(drawloll==11){
drawloll=2
}
lolscore+=drawloll
switch(drawloll){
case 2:lolhahalol.image=UIImage(named:"2");lolll.text=String(lolscore);
case 3:lolhahalol.image=UIImage(named:"card3");lolll.text=String(lolscore);
case 4:lolhahalol.image=UIImage(named:"card4");lolll.text=String(lolscore);
case 5:lolhahalol.image=UIImage(named:"card5");lolll.text=String(lolscore);
case 6:lolhahalol.image=UIImage(named:"card6");lolll.text=String(lolscore);
case 7:lolhahalol.image=UIImage(named:"card7");lolll.text=String(lolscore);
case 8:lolhahalol.image=UIImage(named:"card8");lolll.text=String(lolscore);
case 9:lolhahalol.image=UIImage(named:"card9");lolll.text=String(lolscore);
case 10:lolhahalol.image=UIImage(named:"card10");lolll.text=String(lolscore);
default:lolhahalol.image=UIImage(named:"backofcard")
}
if(lolscore==21){
let alertController = UIAlertController(title: "Blackjack4iOS", message:
"Blackjack", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Continue", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
if(lolscore>21){
let alertController = UIAlertController(title: "Blackjack4iOS", message:
"Busted!", preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Continue?", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
}
}