Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object PerekluchatelSostoyaniy extends App {
- val spisokPerekluchateley = Array(
- (sostoyanie: Int) => (sostoyanie + 1) % 2,
- (sostoyanie: Int) => math.pow(0, sostoyanie).toInt,
- (sostoyanie: Int) => math.cos(sostoyanie * math.Pi / 2).toInt,
- (sostoyanie: Int) => (math.acos(sostoyanie) / (math.Pi / 2)).toInt,
- (sostoyanie: Int) => (sostoyanie to 0).foldLeft(0)((acc, elem) => acc + 1)
- )
- println("Vvedite sostoyanie (1 ili 0):")
- val sostoyanie = readInt
- println("Perekluchennoe sostoyanie: " + spisokPerekluchateley(scala.util.Random.nextInt(5))(sostoyanie))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement