Qbasicnews.com
November 14, 2019, 03:47:19 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Piglatin  (Read 8641 times)
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« on: May 22, 2003, 09:20:10 PM »

Make a program that turns and inputed string to pig latin.
You should know what pig latin is but if you don't this is pig latin...

String: Cat
Piglatin: atcay

or

String: Igloo
Piglatin: Iglooway

Go!

Etlay eesay owhay oodgay ouyay areway!
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
seph
Na_th_an
*****
Posts: 1915



« Reply #1 on: May 22, 2003, 09:39:23 PM »

I could do it, but it would take too much work for this simple little program... like, I mean, a ridiculous amount of work.
Logged

earn.
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #2 on: May 22, 2003, 10:16:24 PM »

and your point. i dont see the trouble
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
seph
Na_th_an
*****
Posts: 1915



« Reply #3 on: May 22, 2003, 10:19:31 PM »

Unless you really need this program very badly, I can't be bothered to spend that much time on it Wink Too much other stuff going on for meh... Sad
Logged

earn.
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #4 on: May 22, 2003, 10:39:15 PM »

I only made it take the first letter. The other kinds I couldn't bother with.

Code:
DEFINT A-Z
DECLARE FUNCTION Parse$ (Word$, Sep$, Word%)
CLS
INPUT "Sentence to Tranlate?", trans$
m = 1
FOR n = 1 TO LEN(trans$)
 l = INSTR(m, trans$, " ")
 IF l THEN m = m + l: k = k + 1
NEXT
FOR o = 1 TO k + 1
 daword$ = Parse$(trans$, " ", o)
 endin$ = LEFT$(daword$, 1)
 wordout$ = RIGHT$(daword$, LEN(daword$) - 1) + endin$ + "ay"
 PRINT wordout$ + " ";
NEXT

DEFSNG A-Z
FUNCTION Parse$ (Word$, Sep$, Word%)
l% = 1: S% = 1
W$ = Sep$ + Word$ + Sep$
DO
 S% = INSTR(S% + 1, W$, Sep$): IF S% = 0 THEN EXIT DO
 SELECT CASE S%
  CASE 0: EXIT FUNCTION
  CASE IS > 1: Wd% = Wd% + 1
   IF Wd% = Word% THEN Parse$ = MID$(W$, l% + LEN(Sep$), S% - l% - LEN(Sep$)): EXIT DO
 END SELECT
 l% = S%
LOOP
END FUNCTION
Logged

am an asshole. Get used to it.
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #5 on: May 22, 2003, 11:24:09 PM »

Ninkazu: The first letter!
Igloo is "iglooway" not "glooiay"
chop is "opchay" not "hopcay"
Close but not quite an all english - pig latin word converter.
Mine is kinda mess up but it works. But it only does a word at a time. Not setences like yours. Nice.

Ninkazu - 4 points

If it worked with all words you would have gotten higher.
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Dav
Administrator
Ancient Guru
*****
Posts: 709



WWW
« Reply #6 on: May 22, 2003, 11:25:51 PM »

Not sure exactly how pig latin works.  All I know about it is from an old 3 stooges clip.

Anyway, here's a quick, throw-together...

Code:

In$ = "david"
Out$ = ""
SELECT CASE UCASE$(LEFT$(In$, 1))
  CASE IS = "A", "E", "I", "O", "U"
    Out$ = In$ + "-way"
  CASE ELSE
    Out$ = RIGHT$(In$, LEN(In$) - 1)
    Out$ = Out$ + "-" + LEFT$(In$, 1) + "ay"
END SELECT
PRINT Out$
Logged

DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #7 on: May 22, 2003, 11:27:42 PM »

This is insanely difficult... you'd have to write some sort of natural language engine to figure out how stuff should be pronounced, then write rules to move certain characters certain places, etc, etc... it's not really worth it.  But if you have working code, I'd like to give it a whirl, just to see if I could make it break.   Cheesy   Good luck on your programming endeavours, anyhow.  Maybe you'll write the next Google!  Smiley
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #8 on: May 22, 2003, 11:36:40 PM »

Quote from: "Dav"
Not sure exactly how pig latin works.  All I know about it is from an old 3 stooges clip.

Anyway, here's a quick, throw-together...

Code:

In$ = "david"
Out$ = ""
SELECT CASE UCASE$(LEFT$(In$, 1))
  CASE IS = "A", "E", "I", "O", "U"
    Out$ = In$ + "-way"
  CASE ELSE
    Out$ = RIGHT$(In$, LEN(In$) - 1)
    Out$ = Out$ + "-" + LEFT$(In$, 1) + "ay"
END SELECT
PRINT Out$


Short. cool. But I changed "david" to "chop" it printed

hop-cay

Not what is was looking for. But since it is short... 10 points!
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Dav
Administrator
Ancient Guru
*****
Posts: 709



WWW
« Reply #9 on: May 22, 2003, 11:42:35 PM »

Oh, I see now.  Ok.  I'll try it again, but I'll have to wait for tommorrow.  I'm out of time tonight.  Bye.

- Dav
Logged

Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #10 on: May 22, 2003, 11:55:03 PM »

Quote from: "whitetiger0990"
Not what is was looking for. But since it is short... 10 points!


But... mine can convert a whole sentence... Cry
The Parse function is a super awesome routine that I think superghost created.
Logged

am an asshole. Get used to it.
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #11 on: May 23, 2003, 12:03:08 AM »

That Parse routine is almost like C's strtok... I've got one just like it that I wrote a while back.  But interesting code, nonetheless... I can go alktay to my riendsfay in igpay atinlay now...  wait... I don't have any friends...  Sad  
j/k
Logged
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #12 on: May 23, 2003, 12:09:50 AM »

I have two friends Smiley (no, not my computer and porn)
Logged

am an asshole. Get used to it.
Dav
Administrator
Ancient Guru
*****
Posts: 709



WWW
« Reply #13 on: May 23, 2003, 12:09:58 AM »

Last try for tonight.  (Getting sloppy, I know)

Code:

In$ = "chop"
Out$ = ""
SELECT CASE UCASE$(LEFT$(In$, 1))
  CASE IS = "A", "E", "I", "O", "U"
    Out$ = In$ + "-way"
  CASE ELSE
    FOR x% = 2 TO LEN(In$)
      SELECT CASE UCASE$(MID$(In$, x%, 1))
        CASE IS = "A", "E", "I", "O", "U": EXIT FOR
      END SELECT
    NEXT
    L$ = LEFT$(In$, x% - 1)
    R$ = MID$(In$, x%, LEN(In$))
    Out$ = R$ + "-" + L$ + "ay"
END SELECT
PRINT Out$


- Dav
Logged

Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #14 on: May 23, 2003, 02:41:08 AM »

Pig latin?? Spucatum tauri!
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!