Keep Talking and Nobody Explodes

Keep Talking and Nobody Explodes

评价数不足
Prime Checker
   
奖励
收藏
已收藏
取消收藏
Modules: Regular Module
文件大小
发表于
更新日期
2.014 MB
2019 年 10 月 28 日 下午 1:17
2021 年 4 月 28 日 下午 12:10
7 项改动说明 ( 查看 )

订阅以下载
Prime Checker

在 eXish 的 2 个合集中
eXish's Modules
122 件物品
Official Twitch Plays Module Collection [OUTDATED]
813 件物品
描述
NOTE: This is a reupload of a module that has lost maintaining, please unsubscribe from the old version: https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1807034913

Find out if shown number from 1-999 is prime or not.

HTML: https://ktane.timwi.de/HTML/Prime%20Checker.html
PDF: https://ktane.timwi.de/PDF/Prime%20Checker.pdf

Prime Checker (PrimeChecker) v1.0.5
Module by Devster_LP, maintained by eXish
Twitch Plays supported
3 条留言
eXish  [作者] 2019 年 12 月 30 日 上午 11:45 
Thanks for letting me know
Dark Heresy 2019 年 12 月 30 日 上午 10:25 
Also, but this is minor, the odds of generating a prime number vs a nonprime number are not 50/50. This is because the random function generates a number from 1 to 99 (change the first argument to 0 for 50/50 odds)
Dark Heresy 2019 年 12 月 30 日 上午 10:11 
This module is broken. I've looked at the code and found a few problems:
The Split function returns a 0-based array, but the index that gets randomly generated goes from 1 (inclusive) to array length (exclusive), meaning it will never return element 0. Also, the \n separated string for nonprimes contains a trailing \n, which means the split function will return an empty string for its final element, which can't be converted to a number by int.Parse.

I don't understand why \n separated strings are used for this in the first place. Why not just create an array of integers? this seems much more efficient. No need to do any splitting or parsing then.