Posts: 341
Threads: 34
Joined: Nov 2010
Reputation:
8
04-15-2011, 09:51 AM
(This post was last modified: 04-17-2011, 08:14 AM by KoBE.)
Alright no more talking...
.Net Coding Challenge #1
Intro:
What's up everyone? I decided to go ahead and try to kick off a challenge.
Details:
Challenge: Pig Latin Translator
End date: May 1, 2011
Details: Create an input where the user can type a sentence be able to translate between Pig Latin and English. You must pass the string to a function and have it return the translated value.
Requirements: Must have atleast (1) function that returns a translated value. Must translate TO AND FROM Pig Latin. Your code also must be commented to help direct others through your code.
Example: I sat on a balloon today. -> I-way at-say on-way a-way alloon-bay oday-tay.
Pig latin standards: I'm not sure if there is an actual definition of pig latin but for the sake of conformity we are going to use these guidlines:
Words beginning with a vowel will remain the same and get '-way' appended to the end. (ex. apple -> apple-way)
Word not beginning with a vowel, will be split at the first vowel. The letters that were cut off at the beginning will be appended to the end then have '-ay' added to the end. (ex. preview post -> eview-pray ost-pay)
Vowels: A,E,I,O,U,Y <--- yes I included y.
How to enter:
Enter by responding to this thread stating are going to attempt this challenge. Do not PM me.
How to submit:
Submit by using a spoiler tag to hide you submission. Include a screen shot, the source code in {code} tags, a download link to the project. (Optional but preferred)
Choosing a winner:
If you complete this.. then you are a winner. This is not a contest to see who 'coded the best'. This is a challenge to see if you can complete it.
Disclaimer:
This is meant to be fun and constructive. By submitting your code for this challenge you agree not to get butt-hurt if somebody criticizes your work. Take the criticism, learn from it, and move on. Also, all comments made should be constructive. NO FLAMING ALLOWED. All flaming attempts will be reported.
For real beginners (including The High Roller):
If you are unsure how to set up a function check out this link. It also has A LOT of good stuff for learning C#/VB.Net.
http://www.homeandlearn.co.uk/net/nets9p1.html
To everyone: Good luck.
Submissions so far:
KoBE
The High Roller
Infinity
Posts: 1,106
Threads: 195
Joined: Sep 2010
Reputation:
17
I cannot do this, if I could, i'd would say scr*w pig latin and make it some Spanish instead!
Posts: 3,538
Threads: 348
Joined: Mar 2010
Reputation:
57
That's quite a tough challenge. I'm not even sure where to start with this..
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
04-15-2011, 06:27 PM
(This post was last modified: 04-15-2011, 06:28 PM by AceInfinity.)
It's basically assigning certain values for text strings to the pig latin version? from what It looks like, which isn't hard, but I don't quite understand how English is turned into pig latin.. I think it should be just a simple program. For this to take effect I would have to learn some pig latin, and I didn't intend on doing that for a coding competition.
So far from the example, it's just appending text to the original string value, but is that the only thing needed for pig latin?
Posts: 1,106
Threads: 195
Joined: Sep 2010
Reputation:
17
04-15-2011, 07:48 PM
(This post was last modified: 04-15-2011, 08:30 PM by Resistance.)
(04-15-2011, 06:27 PM)Infinity Wrote: It's basically assigning certain values for text strings to the pig latin version? from what It looks like, which isn't hard, but I don't quite understand how English is turned into pig latin.. I think it should be just a simple program. For this to take effect I would have to learn some pig latin, and I didn't intend on doing that for a coding competition.
So far from the example, it's just appending text to the original string value, but is that the only thing needed for pig latin?
I change my mind guys. I am starting the code right now, I better get a good reward man.
EDIT: Esto es tan imposible.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
04-15-2011, 07:59 PM
(This post was last modified: 04-15-2011, 07:59 PM by AceInfinity.)
(04-15-2011, 07:48 PM)The High Roller Wrote: I change my mind guys. I am starting the code right now, I better get a good reward man.
My post changed your mind or what? lol, you quoted me but you're speaking to everyone in the thread. Was it something I said? Good luck anyway.
Posts: 1,106
Threads: 195
Joined: Sep 2010
Reputation:
17
04-15-2011, 10:11 PM
(This post was last modified: 04-15-2011, 10:37 PM by Resistance.)
Awesome, I am done with it. Not the best GUI at all. Didn't even work on it. But the functioning works, only one word at a time can be translated. Working on fixing that right now...
EDIT: NVM, ask someone who doesn't have a life to code such a thing. Single words are good enough, place them together and your fine. I don't know how google translate does it.
HERE IS MY RELEASE:
Download Link:
Code: http://www.mediafire.com/?1a98md1h0dduioa
Screeney:
Source (Entirely by me, me only. As usual.):
Code: Public Class Form1
Dim TextR As String = " "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing Then Return
If TextBox1.Text.EndsWith("a") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.EndsWith("e") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.EndsWith("i") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.EndsWith("o") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.EndsWith("u") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.EndsWith("y") Then
TextBox2.Text = (TextBox1.Text + "way")
End If
If TextBox1.Text.StartsWith("b") Then
TextBox2.Text = TextBox1.Text.Replace("b", "")
TextBox2.AppendText("bay")
End If
If TextBox1.Text.StartsWith("g") Then
TextBox2.Text = TextBox1.Text.Replace("g", "")
TextBox2.AppendText("gay")
End If
If TextBox1.Text.StartsWith("c") Then
TextBox2.Text = TextBox1.Text.Replace("c", "")
TextBox2.AppendText("cay")
End If
If TextBox1.Text.StartsWith("d") Then
TextBox2.Text = TextBox1.Text.Replace("d", "")
TextBox2.AppendText("day")
End If
If TextBox1.Text.StartsWith("f") Then
TextBox2.Text = TextBox1.Text.Replace("f", "")
TextBox2.AppendText("fay")
End If
If TextBox1.Text.StartsWith("j") Then
TextBox2.Text = TextBox1.Text.Replace("j", "")
TextBox2.AppendText("jay")
End If
If TextBox1.Text.StartsWith("h") Then
TextBox2.Text = TextBox1.Text.Replace("h", "")
TextBox2.AppendText("hay")
End If
If TextBox1.Text.StartsWith("k") Then
TextBox2.Text = TextBox1.Text.Replace("k", "")
TextBox2.AppendText("kay")
End If
If TextBox1.Text.StartsWith("l") Then
TextBox2.Text = TextBox1.Text.Replace("l", "")
TextBox2.AppendText("lay")
End If
If TextBox1.Text.StartsWith("m") Then
TextBox2.Text = TextBox1.Text.Replace("m", "")
TextBox2.AppendText("may")
End If
If TextBox1.Text.StartsWith("q") Then
TextBox2.Text = TextBox1.Text.Replace("q", "")
TextBox2.AppendText("qay")
End If
If TextBox1.Text.StartsWith("r") Then
TextBox2.Text = TextBox1.Text.Replace("r", "")
TextBox2.AppendText("ray")
End If
If TextBox1.Text.StartsWith("s") Then
TextBox2.Text = TextBox1.Text.Replace("s", "")
TextBox2.AppendText("say")
End If
If TextBox1.Text.StartsWith("t") Then
TextBox2.Text = TextBox1.Text.Replace("t", "")
TextBox2.AppendText("tay")
End If
If TextBox1.Text.StartsWith("v") Then
TextBox2.Text = TextBox1.Text.Replace("v", "")
TextBox2.AppendText("vay")
End If
If TextBox1.Text.StartsWith("w") Then
TextBox2.Text = TextBox1.Text.Replace("w", "")
TextBox2.AppendText("way")
End If
If TextBox1.Text.StartsWith("p") Then
TextBox2.Text = TextBox1.Text.Replace("p", "")
TextBox2.AppendText("pay")
End If
If TextBox1.Text.StartsWith("n") Then
TextBox2.Text = TextBox1.Text.Replace("n", "")
TextBox2.AppendText("nay")
End If
If TextBox1.Text.StartsWith("x") Then
TextBox2.Text = TextBox1.Text.Replace("x", "")
TextBox2.AppendText("xay")
End If
If TextBox1.Text.StartsWith("z") Then
TextBox2.Text = TextBox1.Text.Replace("z", "")
TextBox2.AppendText("zay")
End If
If TextBox1.Text.StartsWith("y") Then
TextBox2.Text = TextBox1.Text.Replace("y", "")
TextBox2.AppendText("yay")
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Process.Start("http://www.supportforums.net/member.php?action=profile&uid=4502")
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim theText As String = TextBox1.Text
Dim Letter As String
For x As Integer = 0 To TextBox1.Text.Length - 1
Letter = TextBox1.Text.Substring(x, 1)
If TextR.Contains(Letter) Then
theText = theText.Replace(Letter, String.Empty)
End If
Next
TextBox1.Text = theText
TextBox2.Select(TextBox1.Text.Length, 0)
End Sub
End Class
I hope I win, if no one submits full version. This is kind of half-ass, but the full would be way too time consuming to code. What do I win anyways?
Posts: 3,538
Threads: 348
Joined: Mar 2010
Reputation:
57
Part of the challenge was to translate a sentence, not a single word.
Also @Infinity,
You're not just appending text, you're jumbling it up as well.
I mean it is possible to do, but it would probably take a while (at least for me seeing as I haven't coded anything in ages).
Posts: 1,677
Threads: 58
Joined: Jul 2010
Reputation:
30
@ The High Roller maybe post your source when everyone has submitted so no-one can copy or get ideas? lol
Also I see you only know how to do single words, you could just put every word in a sentence into a dynamic array.
Then call a handler / method to examine each element of the array.
You have soo much unneeded code it's quite funny but at least you gave it a shot!
More people enter if you want the coding section to be popular!
Seems pretty easy to do, well in java anyway.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
04-16-2011, 03:28 AM
(This post was last modified: 04-16-2011, 03:28 AM by AceInfinity.)
(04-16-2011, 02:40 AM)Fragma Wrote: @Infinity,
You're not just appending text, you're jumbling it up as well.
See I don't know pig latin though so i'd have to take the time to learn how it's derived from the english language first to be able to make the functions to translate it. In his example, all I seen was appending text to the original word really
|