The Furry Forums would like to place cookies on your computer to help us make this website better. To find out more about the cookies, see our privacy notice.
To accept the cookie click here, or please login or register.

Author Topic: Anoni's Programming Challenge!  (Read 1688 times)

0 Members and 0 Guests are viewing this topic.

Offline anoni

  • Zoomorphic Zebra
  • **********
  • awards This user has been a forum member for over 10 years Assigned to someone who is observed to be very friendly toward other members (frequently welcoming people in the Intro board, answering questions, etc.) This user has reported a valid and verified forum bug This user has made a suggestion for the forum that was approved and implemented
  • Posts: 6178
  • Gender: Male
  • This statement is a lie
    • Steam
    • Kingdom of Lacertus (clan website) we're not furry oriented, but we accept furries (especially artists) :P
    • Awards
  • Species: Fox
  • Coloring: Beige
  • Height: 183 cm
  • Weight: 65 KG
  • Build: Slim
  • Currently: Cruising through the 4th dimension
Anoni's Programming Challenge!
« on: September 29, 2014, 06:23:20 AM »
So I decided to make this on a whim, so we'll see if it is successful or not. Basically the game works like this, I come up with a problem (you guys can give me some ideas) and people have to post their solutions to the problem, the solution that is deemed the best wins and the best is deemed under three categories.

  - Cleanliness: Your solution should be easy to read, should be flexible, should not rely on too much (that is if you moved it to another program it could still work for example), should be well commented and so forth
  - Efficiency: Your solution should be quick, the quickness depends on time complexity and space complexity.
  - Correctness: Your solution should be CORRECT, it should work well and should be able to work for any set of data and should give appropriate error messages for inappropriate data.

  Each category is out of 10, the winner of each category is the person who got the most for that category and the winner overall is the person who gets the highest average over these three categories. The rules are this

  - The solution can be made in ANY programming language, script or so forth
  - You are not allowed to use any code found on the internet
  - You are not allowed to use libraries or functions that may already implement the problem, you should use as little libraries as possible, using too many libraries I may subtract marks on cleanliness (even though in general using libraries is a good idea, for the sake of this problem, it isn't)
  - You can post your solution to any problem whenever you want, I'll give a few days notice before I'm deciding to move to a different problem
  - Partial solutions (IE: Solutions that only implement a part of the problem) can still be submitted and will still be marked. You can still get 10/10 for Cleanliness and Efficiency even with a partial solution, but you may lose marks on Correctness.

The first programming challenge is this

FIND PALINDROMES


You should create a function that, given a string, should be able to output whether or not that string CONTAINS a palindrome (that is the word is the same forwards as backwards, like "bob") and should print the palindrome it found

The string: Madam.
Contains: A palindrome "Madam"

The string: "Cant"
Contains: No Palindromes

Note that if the string contains a substring that is a palindrome, it should print out that substring, example

The string: "bill"
Contains: A palindrome "ll"

If there are many palindromes in the string, it should attempt to print out the LONGEST palindrome within that string (if there are multiple "longest" it should just print out the first one it finds)

The string "banana"
Contains: A palindrome "anana"

It should IGNORE any non-alphanumeric characters and only consider palindromes of alphanumeric (A-Z and 0-9), it should also ignore case

The string: "Race car"
Contains: A palindrome "Race car"

Single characters should not be considered palindromes, ie

The string: a
Contains: No palindromes

If you have any more questions, please post them and I'll freely answer, again it can be done in any language. You must post your solution and what language you used below!

CHALLENGE EXERCISE:
A challenge exercise is to accept in a flag that prints out ALL palindromes found in a string, for example

The string: "banana"
Contains: The palindromes "ana" "nan " "ana" "anana"

This is a challenge exercise and doesn't need to be completed to enter the competition, but you will NOT be given extra marks for completing the challenge exercise in Correctness, Cleanliness and Efficiency categories, but you will be given an extra 2 marks for the Overall category.
« Last Edit: September 29, 2014, 06:35:42 AM by anoni »
  • Avatar by: WingedZephyr
  • Signature art by: MrRazot
(int(e-x^2, x = -infinity..infinity))2 = Pi


We fight, we recruit, we are the anthropomorphic army. FDF forever!

$_ = "gntusbovueqrmwkradehijqr"; tr/a-z/lad hijacked under stop sign!/; print $_, "\n";

Offline Hycanith

  • Boisterous Bear
  • **
  • awards This user has been a forum member for over 8 years
  • Posts: 152
  • Gender: Male
  • Shhhh....
    • Skype
    • Steam
    • Awards
  • Species: Cat-Fox!
  • Coloring: Like that! ^
  • Height: Tall.
  • Weight: 130 lbs.
  • Build: Slim.
  • Reference: [link]
  • Currently: That spring clean.
Re: Anoni's Programming Challenge!
« Reply #1 on: October 16, 2014, 02:00:25 AM »
This would be a wonderful idea....IF I HAD THE PATIENCE TO LEARN HOW TO CODE!!!!1! >:(

There must be someone who knows. I want to see this challenge happen. I am preoccupied with learning the ocarina, so I will not be learning a coding language any time soon. (I suppose I am part of the problem then  @.@ )
  • Avatar by: Neko-Maya

Offline anoni

  • Zoomorphic Zebra
  • **********
  • awards This user has been a forum member for over 10 years Assigned to someone who is observed to be very friendly toward other members (frequently welcoming people in the Intro board, answering questions, etc.) This user has reported a valid and verified forum bug This user has made a suggestion for the forum that was approved and implemented
  • Posts: 6178
  • Gender: Male
  • This statement is a lie
    • Steam
    • Kingdom of Lacertus (clan website) we're not furry oriented, but we accept furries (especially artists) :P
    • Awards
  • Species: Fox
  • Coloring: Beige
  • Height: 183 cm
  • Weight: 65 KG
  • Build: Slim
  • Currently: Cruising through the 4th dimension
Re: Anoni's Programming Challenge!
« Reply #2 on: October 16, 2014, 08:35:11 AM »
This problem is a relatively hard problem, but if you're ever interested in learning how to code I can direct you to a wealth of resources that can assist you! I can even help teach you if you'd like. With the power of coding you can achieve anything, it is an art, but you do not create a picture or a song, you create a universe. You can craft symphonies with code, create masterpiece pictures with code, you can bring down governments with code, you can make games with code, you can do anything you could really imagine with code. All things become possible, the computer becomes a magic box that can basically do anything possible!

  So learning how to code is a monumental skill, something you should really consider as it gives you access to achieve anything you put your mind to.
  • Avatar by: WingedZephyr
  • Signature art by: MrRazot
(int(e-x^2, x = -infinity..infinity))2 = Pi


We fight, we recruit, we are the anthropomorphic army. FDF forever!

$_ = "gntusbovueqrmwkradehijqr"; tr/a-z/lad hijacked under stop sign!/; print $_, "\n";

Offline saph the sergal

  • Noble Newt
  • ********
  • awards This user has been a forum member for over 8 years This user has made a suggestion for the forum that was approved and implemented This user has donated to the forum more than once. This user has donated to the forum.
  • Posts: 1203
  • Gender: Male
  • a derpy sergal
    • Awards
  • Species: aussie sergal
  • Coloring: black and purple
  • Height: 6 feet
  • Weight: 50 kilograms
  • Build: in shape
  • Currently: hello darkness my old friend
Re: Anoni's Programming Challenge!
« Reply #3 on: October 16, 2014, 08:39:49 AM »
knowing code is also a great way to get a job but knowing it is handy i am learning c# from a youtuber that does videos i still need to watch them tho but i am waiting for a big data bank then i am gonna do it one thing that will be handy is knowing when i am using to much memory and have alerts pop up
  • Avatar by: xeshaire on fa
on land line is a inanimate object under water it has a life of its own

i have a very dry sense of humor be careful around me :D

Offline anoni

  • Zoomorphic Zebra
  • **********
  • awards This user has been a forum member for over 10 years Assigned to someone who is observed to be very friendly toward other members (frequently welcoming people in the Intro board, answering questions, etc.) This user has reported a valid and verified forum bug This user has made a suggestion for the forum that was approved and implemented
  • Posts: 6178
  • Gender: Male
  • This statement is a lie
    • Steam
    • Kingdom of Lacertus (clan website) we're not furry oriented, but we accept furries (especially artists) :P
    • Awards
  • Species: Fox
  • Coloring: Beige
  • Height: 183 cm
  • Weight: 65 KG
  • Build: Slim
  • Currently: Cruising through the 4th dimension
Re: Anoni's Programming Challenge!
« Reply #4 on: October 16, 2014, 01:31:59 PM »
With a C language you can, in general, keep track of your memory allocation. So you can, in general, know when you run out of memory. Though it's always handy to check

Code: [Select]
SomeType *v = malloc(sizeof(SomeType));
assert(v != NULL); // Make sure we don't run out of memory
  • Avatar by: WingedZephyr
  • Signature art by: MrRazot
(int(e-x^2, x = -infinity..infinity))2 = Pi


We fight, we recruit, we are the anthropomorphic army. FDF forever!

$_ = "gntusbovueqrmwkradehijqr"; tr/a-z/lad hijacked under stop sign!/; print $_, "\n";

Offline saph the sergal

  • Noble Newt
  • ********
  • awards This user has been a forum member for over 8 years This user has made a suggestion for the forum that was approved and implemented This user has donated to the forum more than once. This user has donated to the forum.
  • Posts: 1203
  • Gender: Male
  • a derpy sergal
    • Awards
  • Species: aussie sergal
  • Coloring: black and purple
  • Height: 6 feet
  • Weight: 50 kilograms
  • Build: in shape
  • Currently: hello darkness my old friend
Re: Anoni's Programming Challenge!
« Reply #5 on: October 16, 2014, 01:33:50 PM »
one i saw it had text and use the text to speech so the youtuber (barnacles nerdgasm) had it done so it would say things like your computer is chasing squirrels
  • Avatar by: xeshaire on fa
on land line is a inanimate object under water it has a life of its own

i have a very dry sense of humor be careful around me :D

Offline Hycanith

  • Boisterous Bear
  • **
  • awards This user has been a forum member for over 8 years
  • Posts: 152
  • Gender: Male
  • Shhhh....
    • Skype
    • Steam
    • Awards
  • Species: Cat-Fox!
  • Coloring: Like that! ^
  • Height: Tall.
  • Weight: 130 lbs.
  • Build: Slim.
  • Reference: [link]
  • Currently: That spring clean.
Re: Anoni's Programming Challenge!
« Reply #6 on: October 16, 2014, 03:03:38 PM »
Thank you for the offer Anoni. I will keep that in mind, although I highly doubt I will be learning code any time soon! The last time I attempted code was in my highschool computer programming class! I hope that someone takes up your offer though. Learning the coding language is extraordinarily rewarding according to my university friends as well.
  • Avatar by: Neko-Maya

Offline anoni

  • Zoomorphic Zebra
  • **********
  • awards This user has been a forum member for over 10 years Assigned to someone who is observed to be very friendly toward other members (frequently welcoming people in the Intro board, answering questions, etc.) This user has reported a valid and verified forum bug This user has made a suggestion for the forum that was approved and implemented
  • Posts: 6178
  • Gender: Male
  • This statement is a lie
    • Steam
    • Kingdom of Lacertus (clan website) we're not furry oriented, but we accept furries (especially artists) :P
    • Awards
  • Species: Fox
  • Coloring: Beige
  • Height: 183 cm
  • Weight: 65 KG
  • Build: Slim
  • Currently: Cruising through the 4th dimension
Re: Anoni's Programming Challenge!
« Reply #7 on: October 17, 2014, 09:09:57 AM »
Thank you for the offer Anoni. I will keep that in mind, although I highly doubt I will be learning code any time soon! The last time I attempted code was in my highschool computer programming class! I hope that someone takes up your offer though. Learning the coding language is extraordinarily rewarding according to my university friends as well.

High schools are TERRIBLE at teaching code, they miss the point of it all entirely. Coding is problem solving, it's not syntax, which is what the school teaches you. Basically "Look at this code, this is what it does", it shouldn't be like that
  • Avatar by: WingedZephyr
  • Signature art by: MrRazot
(int(e-x^2, x = -infinity..infinity))2 = Pi


We fight, we recruit, we are the anthropomorphic army. FDF forever!

$_ = "gntusbovueqrmwkradehijqr"; tr/a-z/lad hijacked under stop sign!/; print $_, "\n";

Offline Foxes

  • Vibrating Furby
  • *
  • awards This user has been a forum member for over 8 years
  • Posts: 6
  • Gender: Male
    • Awards
Re: Anoni's Programming Challenge!
« Reply #8 on: October 30, 2014, 12:54:00 AM »
I went ahead and whipped this up for you :3

http://pastebin.com/viP00art

I'm assuming that you know how to execute Java files, if not I can go ahead and compile it into a .jar or .exe for you.

I guess mine is the first submission as well, lol.

Offline anoni

  • Zoomorphic Zebra
  • **********
  • awards This user has been a forum member for over 10 years Assigned to someone who is observed to be very friendly toward other members (frequently welcoming people in the Intro board, answering questions, etc.) This user has reported a valid and verified forum bug This user has made a suggestion for the forum that was approved and implemented
  • Posts: 6178
  • Gender: Male
  • This statement is a lie
    • Steam
    • Kingdom of Lacertus (clan website) we're not furry oriented, but we accept furries (especially artists) :P
    • Awards
  • Species: Fox
  • Coloring: Beige
  • Height: 183 cm
  • Weight: 65 KG
  • Build: Slim
  • Currently: Cruising through the 4th dimension
Re: Anoni's Programming Challenge!
« Reply #9 on: October 30, 2014, 06:59:35 AM »
Alright so it looks good! Let me give a full rating

Correctness:
  - For single words that are full palindromes it passes, for example "bob" "madam" "racecar" "clap" "alphabet" and so forth give the correct response.
  - Palindromes within single word substrings are also correct, things such as "jerry" "banana" "bobby" and so forth give the correct palindrome as well as the largest one so good job! Single character strings also are not considered palindromes which is exactly what we specified so excellent!
  -  Problems occur when we start using multi word strings or strings that have non-alphanumeric characters in them (In the spec you were told strings may include non-alphanumeric characters but you should just ignore them), for example the string "race car" outputs with no palindrome when it should ignore the space, "hello how woh olleh" also gives an incorrect palindrome of "how woh" which is not the longest palindrome, it's interesting that it still ignored the space in this one. Most of my tests using multiword strings failed  this one, so you might want to add special cases for when you encounter a space character
  - The strings are not cap sensitive which is excellent, it doesn't preserve  the case  (so if I inputted "Madam" it'll output "madam") but I can definitely forgive that so well done.

  I can't give you 10 because it doesn't handle the non-alphanumeric case but it handles every other case very well so I'll give it an 8/10

Efficiency:
  - The worst case time complexity is around O(n3) but that's a pretty standard efficiency for this kind of problem. There are some ways to make it more efficient but I'd give you a 10 for this one
  - A problem is that you left some debugging functions in, it causes some unnecessary overhead for the final product and considering it's in a nested loop that debugging function (which does nothing when debugging is disabled) could be called n2 times, so for large n this can give a large overhead. I'm forgiving it though cause it's super easy to remove.
  10/10

Cleanliness:
  - No comments (except the header)!
  - I don't really like the initial for loop (which should be a while loop probably), if you used while(Scanner.hasNext()) instead of for(;;) you could give support for file reading which would be beneficial for testing, otherwise your program will never terminate when reading a file unless the file contains "quit". I understand that the program will never terminate regardless of what you do when reading from stdin, but it's always good to allow for multiple uses of your program.
  - Variable and method names are descriptive (with the exception of the debugger method) so it's pretty easy to follow that, indentation and spacing is well done so all of that is fine.
  - It's interesting that you used Java but didn't really implement the modularity that Java offers, it would of been a better idea to separate the palindrome class away from the main method and have the palindrome class just accept a STRING rather than only accept from standard input. That way I could of tested it on some generated files easier and it would of been more compatible with other programs. Your palindrome class has side effects of printing some stuff which in general it shouldn't have, so making your method a bit more blackbox is a thing to think about as well.

  It looks relatively nice but there are still quite a few niches to get out so 6/10 for cleanliness


  So that's
    8/10 for correctness
    10/10 for efficiency
    6/10 for cleanliness

For a total of
  24/30 or 8/10 overall

  So definitely a good solution! I'm impressed with it working pretty well, the only real problems is to make it add a bit more documentation and make it a bit cleaner and also include cases for when non-alphanumeric characters are involved in the inputted string. Other than that an excellent solution so well done!
« Last Edit: October 30, 2014, 07:10:17 AM by anoni »
  • Avatar by: WingedZephyr
  • Signature art by: MrRazot
(int(e-x^2, x = -infinity..infinity))2 = Pi


We fight, we recruit, we are the anthropomorphic army. FDF forever!

$_ = "gntusbovueqrmwkradehijqr"; tr/a-z/lad hijacked under stop sign!/; print $_, "\n";

Offline Foxes

  • Vibrating Furby
  • *
  • awards This user has been a forum member for over 8 years
  • Posts: 6
  • Gender: Male
    • Awards
Re: Anoni's Programming Challenge!
« Reply #10 on: October 30, 2014, 01:11:47 PM »
That's awesome, thank you! Hopefully someone else will do this as well, it was quite fun.

Offline Ryan Naismith

  • Kuddly Kitten
  • ******
  • awards This user has been a forum member for over 8 years Top 50 Topic Starter Top 100 Most Online
  • Posts: 977
  • Gender: Male
  • Hope, however desperate, is never without merit
    • Skype
    • Awards
  • Species: Coyote! Canis Latrans (best canine)
  • Height: 5'11"
  • Weight: 71 kilograms
  • Build: Toned
  • Currently: BACK
Re: Anoni's Programming Challenge!
« Reply #11 on: October 30, 2014, 01:17:13 PM »
I'm no programmer, but I've got a friend who is. I'll show this to him!

 FDF forever!



To judge from the notions expounded by theologians, one must conclude that God created most men simply with a view to crowding hell.
-Marquis de Sade
The way is lit. The path is clear.
We require only the strength to follow it.

 

Powered by EzPortal