Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Competition : Win a ticket to GeeCON Prague 2014

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

subh kumar wrote:

subh kumar wrote:

subh kumar wrote:

subh kumar wrote://soln by subh71@gmail.com

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Subh, posting the same code again and again every few seconds doesn't qualify as a new solution. A couple of your posts have been deleted from this thread for that very reason. Please do not post the same code multiple times.

P.S: You don't have to use the "quote" button/tag to post your code. Just use the "code" button/tag.
 
subh kumar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
 
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
My second attempt ...

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
250 characters
 
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
 
Marshal
Posts: 79177
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Welcome to the Ranch Konstantin Shchepanovskyi.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Bell Katapa wrote:

Have you tried that code in the test harness which Tim posted at the beginning of this thread? It failed when I tried it.
 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Campbell Ritchie wrote:

Bell Katapa wrote:

Have you tried that code in the test harness which Tim posted at the beginning of this thread? It failed when I tried it.



Yes. It fails on the second test sentence by 1 word "i". Despite passing the first test sentence the code has a flaw (it's searching for patterns even in-between words).
Am working on a version that sticks solely to space-delimited words. It would be so far a unique solution if i pull it off. Thanks for pointing this out.
 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Using java.util.Scanner class ...

 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
... and using java.util.regex.Pattern with java.util.regex.Matcher class

 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Bell Katapa, both your new attempts pass the test harness.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Just a few days left to go now. The competition will close at midnight Prague time (CEST - Central European Summer Time) on Friday 10-Oct. Keep those entries coming.

And remember.... obfuscation is the name of the game. We want to see the most outrageously incomprehensible code you can come up with. Let your imagination run wild!
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Another try!

 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Bell Katapa, sorry for misspelling your name earlier.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Joe Harry, did your solution pass the test harness? I couldn't get it to.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Sorry, I was missing the toLowerCase call!

 
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Tim, which TimeZone should we fit to meet the end-of-Friday criteria ?
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Competition closes at midnight Friday CEST - Central European Summer Time. Which is UTC+02:00.

That's the official cut-off time, but I'm not going to be particularly militant about it so if some entries come in soon after then I'll probably accept them too.
 
Bell Katapa
Ranch Hand
Posts: 58
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Campbell Ritchie wrote:Bell Katapa, sorry for misspelling your name earlier.



Thanks, no big deal. I think you got the spelling right unless my eyes are acting on me.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Bell Katapa wrote:

Campbell Ritchie wrote:Bell Katapa, sorry for misspelling your name earlier.



Thanks, no big deal. I think you got the spelling right unless my eyes are acting on me.


That's the problem with giving Sheriffs so much power. They go around editing their earlier posts and then later posts don't make sense any more.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Sorry, Joanne.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Joe Harry wrote:Sorry, I was missing the toLowerCase call!
. . .

That passed the test harness.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Exciting new Announcement

Just when you thought this competition for a free GeeCON Prague ticket couldn't get any better, thanks to the generosity of the organisers we are now offering all participants a 30% discount on the cost of a ticket.

All you have to do to be eligible is post a competition entry in this thread (all existing participants are automatically eligible). So get your creative coding hats on and show us your most unreadable, confusing, and bizarre solutions you can think of. The wackier the better.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Just for kicks, here's what I came up with for an offline challenge with a non-rancher friend. As CodeRanch Staff I'm not eligible for entry into this competition so I'm posting this for fun and inspiration.

With the following helper methods

 
Adam Czysciak
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Tim, your solution doesn't comply The Rules As far as I understood, the whole solution should fit inside wordOccurrence method. You have helper methods. Not to mention required additional imports.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Adam Czysciak wrote:the whole solution should fit inside wordOccurrence method

Not necessarily. The solution has to comply with the signature of the wordOccurrence method. That is all.

Adam Czysciak wrote:You have helper methods

Yes I do. No rule against it.

Adam Czysciak wrote:Not to mention required additional imports.

No problem with that. The whole of the Java8 JDK is available to you.
 
Adam Czysciak
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
ah, okay I just thought that every solution posted here should be compileable when pasted into wordOccurrence method *without* any other changes in the class source. So, to be clear, you can test it by pasting code and doing auto-organize imports in your favourite IDE, and then launching Or we can put our imports (from JDK8 only) in the solution.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Either is fine Adam. Campbell and I have been testing the solutions so far and we're both more than capable of figuring out the imports ourselves. Well, our IDE's are anyway
 
Greenhorn
Posts: 4
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
My two options ::

version 1:


version 2 using mix of unicode and plain text in sourcecode for obfuscation
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Welcome to the Ranch Lalit m Upadheyay
 
Ranch Hand
Posts: 789
Python C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Last Chance Saloon.... Competition closes tonight, midnight CEST

The entry that we, the CodeRanch Staff, deem to be the most imaginatively obfuscated solution will win a free ticket to GeeCON Prague. All other participants will receive a 30% discount voucher for conference ticket purchases.

Some great entries so far. Keep 'em comin'.
 
Greenhorn
Posts: 2
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hope you like 1-liners

 
You got style baby! More than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic