This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
kodiack5477's profile picture

Pyg Latin Translator

Started by kodiack5477, 19 July 2015 - 01:59 AM
kodiack5477 #1
Posted 19 July 2015 - 03:59 AM
Hello ComputerCraft Forums!

My name is LarzTheFrog, and I am a new at programming with lua, however I wanted to share with you all this fun little program that converts words into Pyg Latin!


--------------------------------------------------
--Variables--
local original
local pyg = "ay"
local first
local second
local final
local end1
local loop
--------------------------------------------------
--Functions--
local function clear()
  term.clear()
  term.setCursorPos()
end
--------------------------------------------------
--Main Code--
print("Welcome to Pyg Latin Translator!")
print("Please enter a word to translate:")
original = tostring(read())
first = original:sub(1,1)
second = original..first
final = second..pyg
print("")
print(final:sub(2,1000))
print("")
--------------------------------------------------
--Ending--
print("Type \"e\" to end")

repeat
end1 = read()
  if end1 == "e" then
	os.reboot()
  else
	print("Incorrect input")
   end

until end1 == "e"
--------------------------------------------------

Download - http://pastebin.com/GuFVJzYi

Thank you all for reading, any feedback and suggestions would be appreciated.
Edited on 19 July 2015 - 02:20 AM
Lyqyd #2
Posted 19 July 2015 - 04:05 AM
Moved to Programs.
biggest yikes #3
Posted 19 July 2015 - 05:39 PM
Isn't it "Pig latin"?
Edited on 19 July 2015 - 03:41 PM
Zenon #4
Posted 19 July 2015 - 05:42 PM
Isn't it "Pig latin"?
It's both, really up to the person spelling it as far as I can tell. :P/>
biggest yikes #5
Posted 19 July 2015 - 05:46 PM
It's both, really up to the person spelling it as far as I can tell. :P/>
Could just be "igpay atinlay" or "ygpay atinlay"
Zenon #6
Posted 19 July 2015 - 05:51 PM
It's both, really up to the person spelling it as far as I can tell. :P/>
Could just be "igpay atinlay" or "ygpay atinlay"

DunDunDun!
cyanisaac #7
Posted 19 July 2015 - 10:26 PM
Why does it reboot? That's kinda annoying and unnecessary unless I am missing something.
H4X0RZ #8
Posted 19 July 2015 - 10:31 PM
Why does it reboot? That's kinda annoying and unnecessary unless I am missing something.
It only reboots when you enter "e". Also I don't think that this program was meant to be included into any major OS, so there is no problem with rebooting.

Actually, after looking at it twice, the reboot feature is unnecessary because it would also end the loop when you enter "e", so the program would end too.
Edited on 19 July 2015 - 08:32 PM
kodiack5477 #9
Posted 20 July 2015 - 06:41 AM
Yeah, I realize that the last part is redundant, I was going to make the program function continuously until the user inputted "end", but I decided to scrap the idea because I was getting bored of the program and the last part is extra that I didn't bother to remove.