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

Turtle decoder.

Started by Kazimir, 18 August 2012 - 02:00 PM
Kazimir #1
Posted 18 August 2012 - 04:00 PM
I wanted to write a program to encode-decode text for turtles, but then I thought that I get tired of updating the code, so that publish of the core of decoder.


------------------reader and decoder [begin]------------------
tabl={}
local function rea(x)
	turtle.select(1) local a = turtle.compareDown()	  --check slot 1
turtle.select(2) local b = turtle.compareDown()		  --check slot 2
turtle.select(3) local c = turtle.compareDown()		  --check slot 3
turtle.select(4) local d = turtle.compareDown()		  --check slot 4
	if a == true then tabl[x] = "0" end		  --if block is in the slot - write code block in table
	if b == true then tabl[x] = "1" end		  --=||=
	if c == true then tabl[x] = "2" end		  --=||=
	if d == true then tabl[x] = "3" end		  --=||=
	turtle.forward()				  --step forward
return tabl[x]						  --return the code block
end
-------------------------------------------------------------
local function dec()
-----------------
local b1=rea(1)--|					 read the one quaternary bit
local b2=rea(1)--|					 =||=
local b3=rea(1)--|					 =||=
local b4=rea(1)--|					 =||=
-----------------/
return hex.decodeHB(b3..b4,b1..b2)	  --decode bits in a symbol and return symbol
end
------------------reader and decoder [end]------------------
For decoding program uses my hex table.
http://www.computerc...adecimal-table/

Spoiler
CastleMan2000 #2
Posted 29 August 2012 - 10:01 PM
Wow, that's pretty cool. You could hook this program up to something else and have a piston tape pushing various codes underneath it!
KaoS #3
Posted 07 September 2012 - 04:23 PM
I would recommend redpower frames as that can push any size structure (I think, never met the cap and I have made enormous structures move). pistons only move 8 blocks, you could also zig-zag it I guess as blue electricity motors are very expensive to make