Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
[QUIZ] Banned Words (#9)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jannis Harder, post: 4450736"] -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 My solution: 1 Send mails with N words (see @steps) 2 delete all words of the clean mails 3 shuffle word list 4 repeat with a smaller N ########### class JannisHardersAlgorithm < RQ9Algorithm def initialize() @steps = [110000,700000,300000,200000,110000, 70000,30000,20000,11000,7000, 3000,2000,1100,700,300,200,110, 70,30,20,11,7,3,2,1] end def run() wordsLeft = @words.dup @steps.each do |count| if count*6 > @words.length next end position = 0 while position < wordsLeft.length testMail = wordsLeft[position .. position+count-1].join(" ") if @filter.clean? testMail (position .. position+count-1).each do |i| wordsLeft[i]=nil end end position += count end wordsLeft.compact! # delete nil words wordsLeft = wordsLeft.sort_by{rand} #shuffle end wordsLeft end end ########## Results : Test: (15000,2,5,true) # 0.1% Runs: 5 Words: 15000 Banned Words: 2 Average Seconds: 0.1430744 Mails: 47 Verified: 5/5 Rebuilt Banned Words Test: (15000,15,5,true) # 1% Runs: 5 Words: 15000 Banned Words: 15 Average Seconds: 0.833412 Mails: 260 Verified: 5/5 Rebuilt Banned Words Test: (15000,150,5,true) # 10% Runs: 5 Words: 15000 Banned Words: 150 Average Seconds: 9.6565792 Mails: 1786 Verified: 5/5 Rebuilt Banned Words -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Darwin) iD8DBQFBqlIu5YRWfc27RzQRAiUmAKCABFWkF/7DHWV1RvmdZYFN1RwiBgCgzebx zKrKCGj2L0SuRaayuRvGJJg= =qzPr -----END PGP SIGNATURE-----[/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[QUIZ] Banned Words (#9)
Top