if textOfEasyHardLabel == "Hard" { //for hard level code if coins.count == 20 || coins.count == 16 || coins.count == 12 || coins.count == 8 || coins.count == 4 { let numberToDelete = Int(arc4random_uniform(UInt32(3))) for _ in 0..<numberToDelete { let tag = Int(arc4random_uniform(UInt32(coins.count))) coins[tag].hidden = true coins.removeAtIndex(tag) count -= [tag].count } } } 

The code does not work correctly. coins.tag always disappears not a random number, but 4, although the condition is from 1 to 3! In connection with what could be such a bug? Maybe there will be ideas ...

  • what is count -= [tag].count ? - Max Mikheyenko
  • There is a variable - count, equal to the number of objects on the screen, i.e. 21. This is for me to control during the test trials. - Spartak
  • This line I generally refused to compile. but if it works for you, it probably creates an array with one element and returns that same 1 through a count. tried to breakpoint and put it and see what line does not do what comes from it - Max Mikheyenko
  • !!! No, I did not. For sure. (I'm new to programming). I'll try. Thank. - Spartak

0