View Full Version : I challenge the little girl (aka inkedmn)
GnuVince
09-29-2002, 10:35 PM
Here's a small Python script I made to help myself doing crossword puzzles: http://darkhost.mine.nu:81/~vince/python/crossword.py
I would like to have a GUI. To have it faster, I'm gonna challenge inkedmn to it. The goal is to reproduce the functionalities of this script in an easy to use GUI.
You may choose any language you want and any toolkit you want (though I'd like it very much if it could run on both Windows and Linux.) I shall be using Ruby/Tk. Since you said GUI's were long to program ("(21:32:02) inkedmn: crap, that'll take awhile"), let's try to do this in two weeks. We'll modify the length of the contest accordingly.
Anyone who wants to judge, just post in (I'd like it if you know a little bit of Ruby so that you can read my code too). You choose what you judge (cuteness of the GUI, speed, Vince is sexier in boxers, etc.)
Inkedmn: do you accept?
inkedmn
09-29-2002, 11:14 PM
pfft. do i accept...
HELL FREAKIN' YES!!
YOU'RE GOING DOWN FRENCHIE!!!
;)
Strike
09-30-2002, 12:13 AM
I'll judge if you want (if not, that's fine too)
GnuVince
09-30-2002, 12:16 AM
Strike: fine with me (as long as you are not biaised by my choice of language)
inkedmn
09-30-2002, 06:48 AM
i'm cool with that as well
btw, i'll be doing this one in java...
inkedmn
09-30-2002, 02:38 PM
oh, and i'm going to need a copy of the dictionary file you open in your script :)
GnuVince
10-01-2002, 08:29 PM
I'm done.
inkedmn
10-01-2002, 09:14 PM
i'm not
:)
inkedmn
10-02-2002, 07:50 PM
almost done :)
GnuVince
10-02-2002, 09:31 PM
I sent my entry to Strike.
inkedmn
10-02-2002, 09:34 PM
oh, and just so everyone knows...
JAVA REGEXS SUCK!!!!!
that is all...
:)
GnuVince
10-02-2002, 10:16 PM
inkedmn: s/REGEXS//
:D
/me hides from Dru!
inkedmn
10-04-2002, 05:03 PM
oh, that's right...
i'm done :)
/me waits for strike to respond to his IM...
inkedmn
10-04-2002, 05:55 PM
alright, code is sent...
it's all up to the judge now :)
GnuVince
10-04-2002, 07:03 PM
Strike: I emailed you an updated version, please use that one.
Strike
10-04-2002, 09:34 PM
Originally posted by GnuVince
Strike: I emailed you an updated version, please use that one.
I'm sorry, but could you please resend? I had a lot of trouble with my internet connection today and it should have bounced back to you.
Strike
10-04-2002, 10:04 PM
oops, I lied, I got it
Strike
10-05-2002, 04:43 AM
Judging is FINISHED, here's the head-to-head comparison.
Error handling:
- Winner = GnuVince, For the "no dict file" situation, his program at least
hints to what the problem is and luckily the Ruby error message thrown is
pretty legible even to the casual user. inkedmn's cryptically does nothing
but return a non-zero value (1, which isn't explained anywhere). Other than
that, both programs don't have much to worry about in terms of
errors/exceptions.
UI packing/layout:
- Winner = GnuVince, though GnuVince's more compact design may seem at first to
be a really good idea, it becomes a non-issue for several reasons. First,
his one-column output means the user might have to scroll anyway, which would
draw the user's mouse far away from the text box. Second, speed isn't that
important when considering the mode of operation of this program - I envision
someone sitting down with a crossword puzzle on their lap, occasionally
poking at the mouse/keyboard to do this .. an extra second or two every 5-10
minutes is negligible. inkedmn's buttons on the bottom are fine for this
reason. Biggest loser for ink here is the lack of a scrollbar or resizable
window.
Code layout/style: (not method)
- Winner = draw, GnuVince picks up ground for having good comments, but overall
I find inkedmn's code easier to read. Yes this biases the language a bit,
but I'm doing my best to ignore it. GnuVince has uneasy expressions such as
"File.new(dictfile).read.split("\n")", which just don't parse well at an
immediate glance (note: I really downplayed this in the evaluation, as any
coder can see what that really does, but I wanted to point it out). Some of
the tk class stuff is kinda nice really (treating listboxes as subclasses of
lists with insert() and delete() for example), but the variable names could
be a bit more clear. Also, why use return sometimes and then not others?
The indentation and brace styles are generally pretty consistently done for
both entrants. Neither commits any super code faux pas, but they each have a
few minor ones (the File.new... line above, and ink's while(true) loop, for
example) Both are "object"-ified meaning they can be used as objects for
others: ink's is inherently this way because of Java, and GnuVince did so
(rightly, and well) with his bottom clause.
Code methodology/algorithm:
- Winner = draw, since both entrants based it on a common starting algorithm,
the coding ideas are pretty much identical as far as the text processing
goes. The UI algorithms are actually pretty similar in terms of how
processes get done, and only the layout really differs between the two, which
is a different section of judging. None have any horrible memory leaks since
they are both gc'ed languages. Clearly a draw.
Overall:
- Winner = GnuVince, But don't think this was a blowout by any means. It was
very tight. The only two categories picked up were extremely close. If I
could have found one more tiny issue with GnuVince's program, I probably
would have declared this a total draw. Overall, both programs met the task
quite well, and are very usable for the task at hand. Both fit their
languages quite well, and generally followed good coding principles. I
actually started working out a scoring system, but I realized that it would
probably be so incredibly close that any small deviation in my scoring would
make or break the winner. I didn't want that, so I decided to do the
head-to-head comparison above to more accurately pick a winner. GnuVince
also picks up bonus points for quicker development, but inkedmn picks up just
as many bonus points for treading into very unfamiliar areas with a
relatively new language. EXCELLENT job by both coders.
Strike
10-05-2002, 04:47 AM
Okay, I can't seem to paste either because of the extended chars, so I will attach each.
Here is GnuVince's:
Strike
10-05-2002, 04:48 AM
And here is ink's:
Strike
10-05-2002, 04:49 AM
Lastly, I apologize if my notes above are cryptic in anyway, it was supposed to be done with the code samples at hand, and I didn't really proofread it. :P It's late, after all. Congratulations GnuVince and inkedmn on a great head-to-head competition!
inkedmn
10-05-2002, 06:29 AM
very nice work Vince!!
thanks for judging Strike!!
let's do it again real soon :)
unruly
10-05-2002, 10:24 AM
[ 9:23AM][unruly@wintermute:~/Files]$ javac crossword.java
crossword.java:14: class Crossword is public, should be declared in a file named Crossword.java
public class Crossword {
^
crossword.java:7: package java.util.regex does not exist
import java.util.regex.*;
^
crossword.java:109: cannot resolve symbol
symbol : class Pattern
location: class Crossword
Pattern pattern = Pattern.compile(regex, 2);
^
crossword.java:109: cannot resolve symbol
symbol : variable Pattern
location: class Crossword
Pattern pattern = Pattern.compile(regex, 2);
^
crossword.java:112: cannot resolve symbol
symbol : class Matcher
location: class Crossword
Matcher matcher = pattern.matcher(lookupWord);
^
5 errors:(
GnuVince
10-05-2002, 11:23 AM
Good job ink!! I knew that this competition would be very tight. I'm gonna go try your app now
Thanks a lot to our friend Strike for juding!
unruly, what version of Java are you running?
GnuVince
10-05-2002, 01:39 PM
I'm having the same problems than unruly :-/ Using apt-get install jdk1.1 from testing.
Strike
10-05-2002, 05:19 PM
Use the latest JDK, 1.4.1 and it will work fine. In fact, it requires it because of the new regex module it uses.
Strike
10-05-2002, 05:20 PM
Oh, and also, for some reason the forum downcased the filename, it's supposed to be "Crossword.java" not "crossword.java" - I consider this to be a forum bug (especially since the names of java files are quite important).
GnuVince
10-05-2002, 05:48 PM
Ah I got it working under Windows.
Halide
10-05-2002, 09:01 PM
hey, I wanna try these... do i need Java VM for windows to run the java program? what about GnuVince's? can you run his Ruby or whatever under winblows? :)
scanez
10-05-2002, 09:09 PM
You need the Java SDK to compile inkedmn's program and then to run it. You can get it from java.sun.com, the latest version is 1.4 as stated earlier. Don't know about ruby...
inkedmn
10-05-2002, 09:16 PM
you need to get the jvm and the dictionary file from vince's site, here: http://darkhost.mine.nu:81/~vince/python/fr_dict.txt
you'll also need the compiled Crossword.class file.
http://www.inkedmn.net/code/java/Crossword.class
save both of those files in the same dir (make sure that dir is in your classpath) and type: java Crossword
and it should work fine
GnuVince
10-06-2002, 03:17 AM
Halide: to run my program under Windows, go to www.rubycentral.com and install the Windows version (One click Windows installer). Next you can run my program the same way you run a Python program:
C:\> ruby crossword.rb
Good luck.
Halide
10-06-2002, 02:57 PM
works great :)
Ludootje
11-13-2002, 02:50 PM
It's not working?
The ruby script:
foo@libranet:~/crossword$ ruby crossword.ruby
crossword.ruby:8:in `require': No such file to load -- tk (LoadError)
from crossword.ruby:8
foo@libranet:~/crossword$ ls -lh
totaal 2.5M
-rw-r--r-- 1 foo foo 464 2002-11-13 19:47 Crossword$1.class
-rw-r--r-- 1 foo foo 1.2K 2002-11-13 19:47 Crossword$ButtonHandler.class
-rw-r--r-- 1 foo foo 4.6K 2002-11-13 19:47 Crossword.class
-rw-r--r-- 1 foo foo 4.6K 2002-11-13 19:46 Crossword.class.precompiled
-rw-r--r-- 1 foo foo 3.7K 2002-11-13 19:46 Crossword.java
-rwxr-xr-x 1 foo foo 2.4K 2002-11-13 19:36 crossword.ruby
-rw-r--r-- 1 foo foo 2.4M 2002-09-14 19:56 fr_dict.txt
foo@libranet:~/crossword$
and the java app loads (doesn't print an error) tells it's loading the dictionary and that I have to wait, then it displays an empty list. When I do a lookup for 'aide', it tells it couldn't find something for it, but the word is in fr_dict.txt
Can someone explain what I did wrong?
gufmn
11-13-2002, 03:43 PM
Where did you save the fr_dict.txt file? It runs fine for me.
Also, I believe you have to fill in all unknown leters with "_". For example, if you want to find lemonaide you would have to do something like: l_mo_aide. Not just aide.
Ludootje
11-13-2002, 04:14 PM
Originally posted by gufmn
Where did you save the fr_dict.txt file? It runs fine for me.
Also, I believe you have to fill in all unknown leters with "_". For example, if you want to find lemonaide you would have to do something like: l_mo_aide. Not just aide.
The fr_dict.txt is in the same dir, as the "ls -lh" shows.
Should it be somewhere else?
You're right about the '_', so now inkedmn's app works fine.
Strike
11-13-2002, 05:56 PM
crossword.ruby:8:in `require': No such file to load -- tk (LoadError)
That is the problem
You don't have the tk libraries for ruby
inkedmn
11-13-2002, 07:50 PM
you might want to check your env vars, i have ruby installed here and there's a var dealing with Tk (can't remember it specifically, atm)
Ludootje
11-14-2002, 03:13 PM
I don't have them, and I forgot to check that. Pretty dumb :/
From "No such file to load" output I was convinced it was talking about the fr_dict.txt, sorry. Installing those libs now... (8)apt-get8))
Yes it works!!
Sorry for the dumb question, I should've looked at line 8, but the error was so confusing :redfaced:
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.