Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // x, f(x), f(f(x)), ..
- def riddleR(f : (Int) => Int, x : Int, num : Int, numanswers : Int) : Boolean =
- num match
- {
- case 0 =>
- {
- numanswers match
- {
- case 0 => readInt == x
- case _ if(numanswers >= 0) => readInt == x && riddleR(f, f(x), 0, numanswers - 1)
- }
- }
- case _ if(num > 0) =>
- {
- print(x + ", ")
- riddleR(f, f(x), num - 1, numanswers)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement