编辑代码

var myString = "Hello world!     -  swift.jsrun.net"
print(myString)
func initGame() {
    iv1.removeAll()
    iv2.removeAll()
    for _ in 0..<rows {
        for _ in 0..<cols {
            iv1.append("a")
            iv2.append("a")
        }
    }
}



func display(){
    print("up image begin-----")
    for i in 0..<rows {
        for j in 0..<cols {
            print(iv1[i*cols+j],separator: " ", terminator: " ")
        }
        print()
    }
    print("up image end------")
    print("down image begin----")
    for i in 0..<rows {
        for j in 0..<cols {
            print(iv2[i*cols+j],separator: " ", terminator: " ")
        }
        print()
    }
    print("down image end ----")
}



func distractorCerte(mount:Int){
    for _ in o..mount {
        let col = Int(arc4random()) % cols
        let row = Int(arc4random()) % rows
        cords.append(row,col)
        iv1[cols*row + col] = images[index]
        iv2[cols*row + col] = images[index]
    }
}



func differenceCreate(mount:Int) {
    for _ in 0..<mount {
        let col = Int(arc4random()) % cols
        let row = Int(arc4random()) % rows

        errorCords.append((row,col))
        let index = Int(arc4random()) % images.count
        let which = Int(arc4random()) % 2
        if which == 0 {
            iv1[cols*row + col] = images[index]
        }
        eles {
            iv2[cols*row + col] = images[index]
        }
    }
}