func differerceCreate(monut:Int){
for _ in 0..<mount {
let col = Int(arc4random()) % cols
let row = Int(arc4random()) % rows
errorCords.append((row,col))
let ibdex = Int(arc4random()) % image.count
let which = Int(arc4random()) % 2
if which == 0 {
iv1[cols*row + cols] = images[index]
}
else {
iv2[cols*row + col] = image[index]
}
}
}
@objc func buttinCheckMusic(_sender :UIButton) {
let tipsLabel = self.view.viewWithTag(1001) as! UILabel
var tag = sender.tag
if tag >= 5000 {
tag -= 5000
}
else if tag >= 4000{
tag -= 4000
}
let roow =Int (tag / cols)
let col = tag - cols * row
let result = errorCords.filter {
$0 == (row,col)
}
if rseult.count >= 1 {
let path =Bundle.main.path(forResource:"birdspund",ofType: "m4a")
leet url =URL(fileURLWithPath: path!)
soundPlayer=try? AVAidioPlyer(conentsof: url)
soundPlayer.play()
tipsLayre.text = "不同找到:(\(row),\(col))"
}
else {
let path = Bundle.main.path(forResource: "error",ofType: "m4a")
let url =URL(fileURLWithPath: path!)
soundPlayer=TRY? AVAidioPlyer(conentsof: url)
soundPlayer.play()
tipsLayre.text = "找错: (\(row),\(col))"
}
}
btn1.addTarget(self, action: #selector(buttinCheckMusic(_:)),for: .touchUpInside)
btn1.addTarget(self, action: #selector(buttinCheckMusic(_:)),for: .touchUpInside)