1619 posts
Posted 05 March 2013 - 01:36 PM
I had a neat idea today. If you're
REALLY, REALLY, BORED TO TEARS, try this. Its called the Re-Write Challenge.
How to Play:
- Go to the ComputerCraft lua folder, and delete everything except for bios, startup, shell, and the lua program. DO NOT DELETE ANY API'S!
- Launch Minecraft, and re-write every standard program in ComputerCraft however you want.
I'd love to see someone upload a YouTube video if they decide to do this. Also, you don't have to (and shouldn't) just recopy the standard programs. Improve on them a bit, make them your own, maybe add line numbers at the left side of edit, or a GUI for redset, the possibilities are endless!
Good Luck!
2151 posts
Location
Auckland, New Zealand
Posted 05 March 2013 - 11:31 PM
I see what you mean by "REALLY, REALLY, BORED TO TEARS", you'd be mad to do this :P/>
797 posts
Posted 06 March 2013 - 12:20 AM
How would it work? The files in the cc folder are the ones that manage what programs to run etc, like running the startup file, so it would be impossible as they are read only and i'm a noob and don't know how to edit them
edit: wow, reread and noticed "except the bios and startup". Nice idea then :D/> although you don't have to rewrite all of them, rewriting the term library would do most of that just fine
1619 posts
Posted 06 March 2013 - 04:18 AM
How would it work? The files in the cc folder are the ones that manage what programs to run etc, like running the startup file, so it would be impossible as they are read only and i'm a noob and don't know how to edit them
edit: wow, reread and noticed "except the bios and startup". Nice idea then :D/>/> although you don't have to rewrite all of them, rewriting the term library would do most of that just fine
You get to keep all APIs. Without the term API, nothing would work.
997 posts
Location
Wellington, New Zealand
Posted 07 March 2013 - 09:15 AM
You could delete all the Lua files, no problem. All the essential APIs are in Java.
Edit: To make computers usable at all, you'd need to rewrite at least the shell - probably as a Lua prompt or you wouldn't have any programs to run.
1619 posts
Posted 07 March 2013 - 06:23 PM
You could delete all the Lua files, no problem. All the essential APIs are in Java.
Edit: To make computers usable at all, you'd need to rewrite at least the shell - probably as a Lua prompt or you wouldn't have any programs to run.
The instructions say to keep bios, startup, shell, and lua.
8543 posts
Posted 08 March 2013 - 06:38 AM
Hard mode: strip everything down to the bare necessities to run the simplest Lua prompt possible. Re-build the system from there.
53 posts
Posted 08 March 2013 - 08:27 AM
If you want more of a challenge, rewrite the bios and the shell.
8543 posts
Posted 08 March 2013 - 08:49 AM
If you want more of a challenge, rewrite the bios and the shell.
That is precisely what I said above; only a Lua prompt, nothing more.
1190 posts
Location
RHIT
Posted 08 March 2013 - 09:05 AM
I think I'm going to take this challenge. Video? Probably not - that would be boring for people because I can't talk and code at the same time. Maybe I'll post my progress on github.
I don't really see why you say you'd have to be really bored. It actually sounds like fun to me XD
1619 posts
Posted 08 March 2013 - 06:17 PM
I think I'm going to take this challenge. Video? Probably not - that would be boring for people because I can't talk and code at the same time. Maybe I'll post my progress on github.
I don't really see why you say you'd have to be really bored. It actually sounds like fun to me XD
You'd have to be really bored because this would take AGES.
404 posts
Location
St. Petersburg
Posted 08 March 2013 - 06:37 PM
it wouldnt take that long
the java-builtins are a significant chunk of it, so it shouldnt take long
writing an OS from just the BIOS of a real computer would
EDIT: btw, you can erase the APIs too, because the term API functions are stored in the natives table
2nd EDIT: im definitely going to try this :D/>
my only rom file will be one that holds this code:
dofile("/startup")
3rd EDIT: i just realized that im going to need a BIOS prompt, so im just using a while-true loadstring loop
997 posts
Location
Wellington, New Zealand
Posted 08 March 2013 - 06:43 PM
writing an OS from just the BIOS of a real computer would
Writing an OS for a real computer is surprisingly easy. Writing one like Windows is hard, but that's only because Windows has so much stuff in it.
404 posts
Location
St. Petersburg
Posted 08 March 2013 - 06:45 PM
writing an OS from just the BIOS of a real computer would
Writing an OS for a real computer is surprisingly easy. Writing one like Windows is hard, but that's only because Windows has so much stuff in it.
hand-typed from the BIOS terminal??? hell no. thats hard as fuck.
997 posts
Location
Wellington, New Zealand
Posted 08 March 2013 - 06:46 PM
writing an OS from just the BIOS of a real computer would
Writing an OS for a real computer is surprisingly easy. Writing one like Windows is hard, but that's only because Windows has so much stuff in it.
hand-typed from the BIOS terminal??? hell no. thats hard as fuck.
No, I was thinking of writing it with an actual editor and compiler on a different computer. Wait, what's a BIOS terminal?
1190 posts
Location
RHIT
Posted 08 March 2013 - 07:07 PM
No, I was thinking of writing it with an actual editor and compiler on a different computer. Wait, what's a BIOS terminal?
Think he means default shell. (?)
290 posts
Location
St.Louis, MO
Posted 08 March 2013 - 07:21 PM
This is my BIOS.lua
print("Lets do this.")
290 posts
Location
St.Louis, MO
Posted 08 March 2013 - 07:27 PM
This is my BIOS.lua
print("Lets do this.")
Nevermind…
404 posts
Location
St. Petersburg
Posted 08 March 2013 - 08:16 PM
Think he means default shell. (?)
yeah, i thought "prompt" while i typed "terminal"
there seems to be some weird file requirements in CC
it doesnt seem tolerant of changes of any kind
any clues as to what the minimum requirements are?
997 posts
Location
Wellington, New Zealand
Posted 08 March 2013 - 08:53 PM
Think he means default shell. (?)
yeah, i thought "prompt" while i typed "terminal"
there seems to be some weird file requirements in CC
it doesnt seem tolerant of changes of any kind
any clues as to what the minimum requirements are?
The BIOS on a PC doesn't have a prompt.
Have you tried these minimum requirements?
* Have a bios.lua
* Extract CC to a folder called ComputerCraft and then delete the zip file before you try editing any files.
404 posts
Location
St. Petersburg
Posted 08 March 2013 - 10:51 PM
–snip–
Have you tried these minimum requirements?
* Have a bios.lua
* Extract CC to a folder called ComputerCraft and then delete the zip file before you try editing any files.
well, i discovered that my problem is that the /rom directory is required
it can be empty, but it still has to be present
1619 posts
Posted 09 March 2013 - 04:10 AM
–snip–
Have you tried these minimum requirements?
* Have a bios.lua
* Extract CC to a folder called ComputerCraft and then delete the zip file before you try editing any files.
well, i discovered that my problem is that the /rom directory is required
it can be empty, but it still has to be present
With no rom folder, the computer would be a brick. Also, for people calling this easy, you have to re-write every standard program in CC. (Fine, you dont have to rewrite secret/alongtimeago) :P/>
404 posts
Location
St. Petersburg
Posted 09 March 2013 - 04:42 AM
With no rom folder, the computer would be a brick. Also, for people calling this easy, you have to re-write every standard program in CC. (Fine, you dont have to rewrite secret/alongtimeago) :P/>
we are saying it's easy because it
is easy.
as long as you have a prompt to edit files, you're golden
and the programs in /rom aren't all that spectacular, with the exception of edit and paint
1619 posts
Posted 09 March 2013 - 12:49 PM
With no rom folder, the computer would be a brick. Also, for people calling this easy, you have to re-write every standard program in CC. (Fine, you dont have to rewrite secret/alongtimeago) :P/>/>
we are saying it's easy because it
is easy.
as long as you have a prompt to edit files, you're golden
and the programs in /rom aren't all that spectacular, with the exception of edit and paint
Sorry, by easy I meant time-consuming. And like I said, try to change the programs; make them your own.
290 posts
Location
St.Louis, MO
Posted 09 March 2013 - 06:45 PM
why wont my bios.lua work? this is it
while true do
loadstring(io.read())()
end
when i start a new computer its just a blank screen that has nothing and does nothing
1619 posts
Posted 09 March 2013 - 06:47 PM
why wont my bios.lua work? this is it
while true do
loadstring(io.read())()
end
when i start a new computer its just a blank screen that has nothing and does nothing
Have you deleted the APIs? io is an API, and read simply checks for key presses.
290 posts
Location
St.Louis, MO
Posted 09 March 2013 - 07:04 PM
why wont my bios.lua work? this is it
while true do
loadstring(io.read())()
end
when i start a new computer its just a blank screen that has nothing and does nothing
Have you deleted the APIs? io is an API, and read simply checks for key presses.
but io is in java not the apis folder right?
1619 posts
Posted 09 March 2013 - 07:06 PM
why wont my bios.lua work? this is it
while true do
loadstring(io.read())()
end
when i start a new computer its just a blank screen that has nothing and does nothing
Have you deleted the APIs? io is an API, and read simply checks for key presses.
but io is in java not the apis folder right?
Nope! All of the file system functions in io are just wrappers of fs, and read() os.pullEvent's key presses.
290 posts
Location
St.Louis, MO
Posted 09 March 2013 - 07:20 PM
so would
while true do
loadstring(read())()
end
work?
404 posts
Location
St. Petersburg
Posted 09 March 2013 - 07:33 PM
so would
while true do
loadstring(read())()
end
work?
yes, but it isnt nice looking at all
and there's no error handling
620 posts
Location
Holland
Posted 09 March 2013 - 10:28 PM
I am gonna try this. I will record it and speed it up. How many times faster should I do?
2151 posts
Location
Auckland, New Zealand
Posted 09 March 2013 - 10:51 PM
Depends how long you take, I wouldn't want to watch for more than a few minutes, maybe 5 maximum.
7508 posts
Location
Australia
Posted 09 March 2013 - 10:53 PM
so would
while true do
loadstring(read())()
end
work?
No read() is defined in the CC bios.lua file :P/>
997 posts
Location
Wellington, New Zealand
Posted 10 March 2013 - 12:15 AM
so would
while true do
loadstring(read())()
end
work?
Nope, because read is in Lua.
Edit: I should scroll down before I reply.
515 posts
Location
Australia
Posted 10 March 2013 - 12:42 AM
You shouldn't delete the bios. It contains some really essential stuff, like os.shutdown management.
423 posts
Location
AfterLifeLochie's "Dungeon", Australia
Posted 10 March 2013 - 12:50 AM
You shouldn't delete the bios. It contains some really essential stuff, like os.shutdown management.
It's fine if you replace them with equivalent functions. The worst you can do is introduce code that causes hangs, but CC has protection against this.
(Edit: To explain briefly, computers are terminated (forcefully, by thread death) if they don't yield back to the Java side of things. This is why infinite loops aren't infinite - as they get broken out of.)
620 posts
Location
Holland
Posted 10 March 2013 - 01:35 AM
Ok i started this with a startup file with this but it doesn't work :(/>
--[[
Simple Bios(lua prompt)
]]
print("Simple Bios Loaded")
while true do
write(">")
command = read()
local ok, err = pcall(loadstring(command)())
if not ok then
print("Error: "..err)
end
end
it attempts to call nil on line 5
620 posts
Location
Holland
Posted 10 March 2013 - 01:36 AM
found error now nevermind
404 posts
Location
St. Petersburg
Posted 10 March 2013 - 10:05 AM
You shouldn't delete the bios. It contains some really essential stuff, like os.shutdown management.
os.shutdown is java
bios.lua just replaces it with a wrapper that has a while true yield at the end just in case
the code is literally
local nativeshutdown = os.shutdown
function os.shutdown()
nativeshutdown()
while true do
coroutine.yield()
end
end
same for reboot
local nativereboot = os.reboot
function os.reboot()
nativereboot()
while true do
coroutine.yield()
end
end
there isnt a single bit of code in bios.lua or any programs or apis in /rom that is essential
17 posts
Posted 11 March 2013 - 12:29 PM
If you want the hardest challenge delete your minecraft and rewrite minecraft from binary.
404 posts
Location
St. Petersburg
Posted 11 March 2013 - 02:15 PM
If you want the hardest challenge delete your minecraft and rewrite minecraft from binary.
aaaaaaaaaand im out
379 posts
Location
Hawaii
Posted 11 March 2013 - 07:18 PM
If you want the hardest challenge delete your minecraft and rewrite minecraft from binary.
That kills it.
Even if you meant "from Java", …
404 posts
Location
St. Petersburg
Posted 12 March 2013 - 06:25 AM
If you want the hardest challenge delete your minecraft and rewrite minecraft from binary.
That kills it.
Even if you meant "from Java", …
i think he was talking about JVM, which is the bytecode java is compiled to
515 posts
Location
Australia
Posted 13 March 2013 - 11:33 PM
Erm, well I suppose if anyone wants to do this challenge, here's a pretty barebones bios.lua (It launches to a lua prompt)
Spoiler
local function newLine()
local wid, hi = term.getSize()
local x, y = term.getCursorPos()
if y == hi then
term.scroll(1)
term.setCursorPos(1, y)
else
term.setCursorPos(1, y+1)
end
end
local nativeShutdown = os.shutdown
function os.shutdown()
nativeShutdown()
while true do
coroutine.yield()
end
end
local nativeReboot = os.reboot
function os.reboot()
nativeReboot()
while true do
coroutine.yield()
end
end
local function reader()
local data = ""
local visibleData = ""
local startX, startY = term.getCursorPos()
local wid, hi = term.getSize()
while true do
term.setCursorBlink(true)
local e, p1 = coroutine.yield()
if e == "key" and p1 == 14 then
data = data:sub(1, -2)
elseif e == "key" and p1 == 28 then
newLine()
return data
elseif e == "char" then
data = data .. p1
end
term.setCursorPos(startX, startY)
if #data+startX+1 > wid then
visibleData = data:sub(-1*(wid-startX-1))
else
visibleData = data
end
term.write(visibleData .. " ")
local curX, curY = term.getCursorPos()
term.setCursorPos(curX-1, curY)
end
end
while true do
term.setTextColor(1)
term.setBackgroundColor(32768)
term.write("lua> ")
local toRun, cError = loadstring(reader(), "error")
if toRun then
setfenv(toRun, getfenv(1))
local err, code = pcall(toRun)
term.setBackgroundColor(32768)
if not err then
if term.isColor() then
term.setTextColor(16384)
end
term.write(code)
end
else
if term.isColor() then
term.setTextColor(16384)
end
term.write(cError)
end
newLine()
end
620 posts
Location
Holland
Posted 13 March 2013 - 11:59 PM
I've started doing this I think I will upload episode 1 today.
I have done:
-Startup lua prompt with function and table and nil detection
-started work on edit program have problems with scrolling
Cheers
379 posts
Location
Hawaii
Posted 15 March 2013 - 09:02 PM
i think he was talking about JVM, which is the bytecode java is compiled to
I know, that's why I said "even". :P/>
252 posts
Location
The Netherlands
Posted 17 March 2013 - 12:06 AM
If you want the hardest challenge delete your minecraft and rewrite minecraft from binary.
Yeah, great idea! Wait! Why don't we just wipe our hard drives and write a custom OS that is able to compete with Windows, Linux or OS X?
Wait!! Why don't we just create our own computer?
Spoiler
Extra challenge: make it using only wood and duct tape!
404 posts
Location
St. Petersburg
Posted 17 March 2013 - 12:02 PM
why dont we create our own materials to build the computer with?
2088 posts
Location
South Africa
Posted 17 March 2013 - 12:43 PM
I've started doing this I think I will upload episode 1 today.
I have done:
-Startup lua prompt with function and table and nil detection
-started work on edit program have problems with scrolling
Cheers
Can you upload video please? :P/>
379 posts
Location
Hawaii
Posted 17 March 2013 - 03:48 PM
How bout we create our own planet, with which we recreate and reinvent technology?
620 posts
Location
Holland
Posted 17 March 2013 - 09:47 PM
I've started doing this I think I will upload episode 1 today.
I have done:
-Startup lua prompt with function and table and nil detection
-started work on edit program have problems with scrolling
Cheers
Can you upload video please? :P/>/>
Gonna do it I messed up with the timer cause I did bugfixes off camera
620 posts
Location
Holland
Posted 17 March 2013 - 10:57 PM
Edited on 17 March 2013 - 11:31 PM
379 posts
Location
Hawaii
Posted 17 March 2013 - 11:09 PM
Uploading done:
Ok its cutting it out now will be done soon
Half an hour…
Edit: Shucks, still processing..
252 posts
Location
The Netherlands
Posted 18 March 2013 - 03:03 AM
Great job haha!
BTW are you Dutch? Lol.
620 posts
Location
Holland
Posted 18 March 2013 - 04:32 AM
I am
1522 posts
Location
The Netherlands
Posted 18 March 2013 - 12:43 PM
2151 posts
Location
Auckland, New Zealand
Posted 18 March 2013 - 01:13 PM
379 posts
Location
Hawaii
Posted 18 March 2013 - 02:31 PM
Oh, its only 5 minutes…I swear yesterday it said 37:something…perhaps it said that because it was processing.
620 posts
Location
Holland
Posted 18 March 2013 - 07:38 PM
Oh, its only 5 minutes…I swear yesterday it said 37:something…perhaps it said that because it was processing.
That was indeed the case
379 posts
Location
Hawaii
Posted 18 March 2013 - 07:58 PM
Oh, its only 5 minutes…I swear yesterday it said 37:something…perhaps it said that because it was processing.
That was indeed the case
Almost thought I was imagining things :P/>