# Implement Random Access with Redstone

I'm trying to build a machine in Minecraft that will act similarly to an array. It will be implemented using physical blocks, not using a traditional redstone CPU type architecture of redstone signal 1s & 0s. It will be a collection of like-sized cells (say 3x3x3) and I would like to be able to "access" any cell at random. My needs for accessing the cells can be satisfied by either travelling to the cell using the `tp` command or by using the `clone` command.

I've given some thought to this and could only come up with a sequential access solution on my own. I've attempted to find documentation on how random access is implemented in computers, but I didn't take Data Structures and Algorithms in college and am unsure of what to search for :P Besides that, there is the in-game limitation of not being able to specify a variable for the `tp` or `clone` command.

The best solution I've come up with so far is to have the addressing work sequentially, by assigning two `scoreboard objectives` to a `minecart`. The first `objective` would be the desired address of the cell and the second would be the cart's current address location. Then, the cart would be `tp`'d ahead by the offset (3 blocks), the current address`objective` would increment, the cart's current address would be compared to the desired address. If the cart's address was lower, then it would be `tp`'d to the next offset, where the process would repeat. Otherwise, the process will have been completed and the `minecart` will reset itself by some arbitrary process.

So for example:

``````- array starts at address 0 along the X axis (X=0)
- cells are offset by 3 blocks
- minecart starts at address 0 (A=0)
- we want the cell at address 4 (D=4)

1 set the desired address objective for the minecart (D=4)
2 set the current address objective for the minecart (A=0)
3 tp the minecart ahead by the offset (A=0,X=3)
4 increment the minecart's current address (A=1,X=3)
6 A<D => repeat steps 1-5 until A==D
7 COMPLETE => reset minecart
``````

Does anybody know of a more efficient way to achieve this goal? Can anybody think of a way to implement Random Access here, so that each cell can be accessed equally as fast as each other cell? Alternatively, can anybody think of a way to improve my Sequential solution?

• Is this different from How can I make a Random Number Generator with vanilla redstone? Commented Feb 2, 2015 at 7:25
• @SevenSidedDie I didn't thoroughly read this question but it seems that this question is about RAM.
– Q20
Commented Feb 2, 2015 at 11:09
• Yes it is different. Commented Feb 2, 2015 at 15:44
• Is it possible to send the minecart down the track with a fill clock that will tp the minecart down quickly? Commented Feb 3, 2015 at 0:51