Also, change of plans for me, I am also able to work on my program this Saturday, which is nice
- ComputerCraft | Programmable Computers for Minecraft
- → Tjakka5's Content
Tjakka5's Content
There have been 221 items by Tjakka5 (Search limited from 10-February 22)
#177950 augustas656's read() replacement questions topic
Posted by
Tjakka5
on 11 May 2014 - 01:05 PM
in
Ask a Pro
viluon, on 11 May 2014 - 12:54 PM, said:
Tjakka5, on 11 May 2014 - 12:52 PM, said:
local function test(func)
if func == "a" then a()
elseif func == "b" then b()
elseif func == "c" then c()
end
local function a()
print("a")
end
local function b()
print("b")
end
local function c()
print("c")
end
test('a")
test("c")
test("b")
I dont think this would be useful in anyway, but yeah, its somewhat possible.
Edit:test('a") should be test("a") and it wouldn't work anyway, missing end of the if statement.
I'm sorry, it has been such a long time since I have programmed ComputerCraft stuff.
Also, the test('a") might work, but I'm not sure.
#177945 augustas656's read() replacement questions topic
Posted by
Tjakka5
on 11 May 2014 - 12:52 PM
in
Ask a Pro
local function test(func)
if func == "a" then a()
elseif func == "b" then b()
elseif func == "c" then c() end
end
local function a()
print("a")
end
local function b()
print("b")
end
local function c()
print("c")
end
test("a")
test("c")
test("b")
I dont think this would be useful in anyway, but yeah, its somewhat possible.
#177701 Boolean algebra. with ComputerCraft
Posted by
Tjakka5
on 09 May 2014 - 08:51 PM
in
General
local function XOR(a, B)/> return OR(NOT(OR(AND(a, B)/>, NOT(a))), NOT(OR(AND(a, B)/>, NOT(B)/>))) end
Next up I'll be dealing with half adders and full adders, which I can manipulate to do all the other logic gates using a demux.
Because adders have more variables (8 bit input, 8 bit output, 8 Cin's, 8 Couts) I probably have to setup some variables, unless I can come up with a smart way to... do stuff.
#177671 Boolean algebra. with ComputerCraft
Posted by
Tjakka5
on 09 May 2014 - 03:23 PM
in
General
Technically you could eventually run programs on that CPU, but it would be simple programs like NIM I'd reckon, maybe, just maybe Pong.
#177668 Boolean algebra. with ComputerCraft
Posted by
Tjakka5
on 09 May 2014 - 03:09 PM
in
General
Lignum, on 09 May 2014 - 03:03 PM, said:
Tjakka5, on 09 May 2014 - 02:58 PM, said:
And the things about this is to only be using those 2 functions, not anything like loops or if statements, as that would defeat the whole point.
Yes, but, just to clarify things;
I am using ComputerCraft as a logic simulator. I gave it the 2 core things of binary, OR and NOT, so that you can create every logic gate with it, and eventually a CPU (I hope).
#177660 Boolean algebra. with ComputerCraft
Posted by
Tjakka5
on 09 May 2014 - 02:40 PM
in
General
I haven't played around with CC in a while, so I decided to do something with it that I have been into for ages;
Boolean Algebra.
You probably know what it is; it's just like redstone, it holds either the state true or false where true overwrites the false.
This is binary, and it's the core of every computer. You use it to make logic gates, so make a ALU, CPU, etc, the possibilies are endless.
So I wrote 2 small snippets of code that simulates the core of binary, the OR and NOT gate.
EDIT: Lignum gave me some better code; thanks
local function OR(a, B)/>/> return a or b end local function NOT(a) return not a end
The OR gate will look at both inputs, and if either of them is true it will return true.
The NOT gate will return the opposite of the value of the input, so if a is true, it will return false and vice versa.
Using this, and only this, no if statements, no loops, no math. functions we can create everything, and that's what I wanted to share with you guys.
I'll keep this thread updated as I create more things with these 2 basic functions, and my goal will be to have a simple 8 bit CPU.
AND Gate:
local function OR(a, B)/>/> return a or b end local function NOT(a) return not a end local function AND(a, B)/> return NOT(OR(NOT(a), NOT(B)/>)) end local a = false local b = false local o = AND(a, B)/>/>/>/> print(o)
#168436 Guess Who's Below
Posted by
Tjakka5
on 16 March 2014 - 04:15 PM
in
Forum Games
Engineer?
#162685 How would you simulate a programming language in the language Lua?
Posted by
Tjakka5
on 30 January 2014 - 02:32 PM
in
General
I however, have no idea how you would simulate a language in lua, so I was hoping if any of you could give me some tips/guidelines, etc.
Thanks in advance.
#158169 Corrupt-A-Wish!
Posted by
Tjakka5
on 26 December 2013 - 03:53 PM
in
Forum Games
I wish the logic in my love2d game would actually work properly.
#157410 Todo list.
Posted by
Tjakka5
on 20 December 2013 - 10:12 AM
in
Programs
Death, on 18 December 2013 - 08:30 PM, said:
Give me less than an hour and I'll add in support for two, along with a few minor bug fixes.
EDIT: Yeah, I'm not even going to begin on how bad looking at that code hurt my eyes.
It's the kind of code you accept works, but it doesn't need to be clean.
I'm not editing that.
I'll make a new one.
Goodluck, logic's a dick.
#153091 Rendering Buffering/double Buffering?
Posted by
Tjakka5
on 16 November 2013 - 05:58 AM
in
Ask a Pro
I am guessing this was because the way you would print the GUI is that you calculate a piece, render it, calculate, render, etc for 1 frame.
I instantly thought this could be fixed by making a buffer (What is probably the thing that everyone does), meaning that you calculate something, store it somehow, calculate the next thing, store it, and print every frame in one go without calculating.
Is this right? And if so, how would you do that?
#150085 Team A Vs Team B
Posted by
Tjakka5
on 23 October 2013 - 08:21 AM
in
Forum Games
Team B
Old total: 20
New total: 25
#149670 Team A Vs Team B
Posted by
Tjakka5
on 20 October 2013 - 12:09 PM
in
Forum Games
Old total: 95
New total: 100
- ComputerCraft | Programmable Computers for Minecraft
- → Tjakka5's Content


