Search found 4 matches

by Mokor
Thu May 19, 2011 6:14 am
Forum: Challenges Solved
Topic: One Minute Man
Replies: 39
Views: 4538

Did it in Groovy. Getting the text from the Website and comparing it to the previous result. If there is a difference it is shown on the console. The programm ran for 514minutes :D def url = new URL('http://www.hacker.org/challenge/misc/minuteman.php') def data = url.getText() def result = data def ...
by Mokor
Wed May 18, 2011 2:51 pm
Forum: Challenges Solved
Topic: Valuation
Replies: 103
Views: 9353

Groovy Solution

It is possibly not the best Groovy solution, because it looks to much like plain old Java, but it works fine. def text = "93752xxx746x27x1754xx90x93xxxxx" def result = 0 def pointer = 0 textAsChars = text.toList() while(pointer < textAsChars.size()) { curChar = textAsChars[pointer] if(curC...
by Mokor
Wed May 18, 2011 1:28 pm
Forum: Challenges Solved
Topic: 3280
Replies: 20
Views: 1769

My solution in Groovy: def words = new File("rfc3280.txt").getText().split() def wordSet = words as Set wordSet = wordSet.findAll { w -> w.size() == 9 } def textMap = [:] wordSet.each { textMap.put(it, words.count(it)) } def result = textMap.values().max() println textMap.findAll { it.valu...
by Mokor
Wed May 18, 2011 11:51 am
Forum: Challenges Solved
Topic: Lorem Ipsum
Replies: 34
Views: 3779

I wanted to solve it with Groovy. Here is the result:

Code: Select all

def words = new File("lorem.txt").getText().split()
words.each( {if (words.count(it) == 1) println it} )