Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numbers = [324, 258, 193, 42, 372, 307, 241, 49, 485, 420, 355, 68, 522, 456, 391, 74, 209, 144, 79, 26, 281, 215, 150, 36, 323, 257, 192, 42, 421, 356, 290, 57, 461, 395, 330, 64, 428, 363, 297, 58, 558, 493, 427, 81, 245, 180, 108, 31, 282, 217, 151, 36, 479, 414, 349, 67, 231, 166, 95, 29, 392, 327, 262, 53, 264, 198, 133, 33, 448, 383, 317, 62, 195, 130, 70, 24, 142, 77, 46, 17, 241, 176, 104, 30, 178, 113, 62, 22, 303, 238, 172, 39, 348, 283, 217, 46, 142, 77, 46, 17, 305, 239, 174, 39, 332, 266, 201, 43, 193, 128, 70, 24, 231, 166, 95, 29, 212, 147, 81, 26, 299, 234, 169, 38, 185, 120, 65, 23, 114, 50, 35, 14, 246, 181, 109, 31]
- attacks = numbers.split(?\n).each_slice(4).map do |attack|
- {pure: attack[0].to_f,
- weak: attack[1].to_f,
- neutral: attack[2].to_f,
- resisted: attack[3].to_f}
- end
- def formula damage, defence
- damage * (1 - (0.5 + 0.19 * Math.log((defence - damage)/15 + 1, 10)))
- end
- ignore_neutral = 135
- valid = true
- attacks.each do |attack|
- if attack[:pure] < ignore_neutral * 2
- # Biggest possible result
- if formula(attack[:pure], 260.0) < attack[:neutral] - 1
- puts "Result too small D:"
- puts formula(attack[:pure], 260.0), attack[:neutral] - 1
- valid = false
- end
- # Smallest possible result
- if formula(attack[:pure] - 1, 264.0) > attack[:neutral]
- puts "Result too big D:"
- puts formula(attack[:pure] - 1, 264.0), attack[:neutral]
- valid = false
- end
- end
- end
- puts valid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement