EDIT: no actually that would be ridiculously slow... Ignore that, I have no idea
- ComputerCraft | Programmable Computers for Minecraft
- → ben657's Content
ben657's Content
There have been 48 items by ben657 (Search limited from 10-February 22)
#64289 GIFTS!
Posted by
ben657
on 26 December 2012 - 12:22 AM
in
General
Sammich Lord, on 26 December 2012 - 12:19 AM, said:
ben657, on 26 December 2012 - 12:18 AM, said:
Sammich Lord, on 26 December 2012 - 12:13 AM, said:
Well in my case, the shirt said "The cake is a lie" so it's not too bad!
No idea, haven't seen that one, this is just navy blue with that on the front in scribbled black writing, think its meant to be the original portal reference rather than minecraft
#64287 GIFTS!
Posted by
ben657
on 26 December 2012 - 12:18 AM
in
General
Sammich Lord, on 26 December 2012 - 12:13 AM, said:
Well in my case, the shirt said "The cake is a lie" so it's not too bad!
#60367 Ludum Dare 25
Posted by
ben657
on 16 December 2012 - 01:09 PM
in
General
http://www.ludumdare.com/compo/
Considering the amount of programmers around here, I was just wondering if anybody else decided to compete?
Personally I've gotten a bad start to my entry, but I'm hoping to get a lot done tomorrow ready for hand in time!
#57301 Why do you hack?
Posted by
ben657
on 07 December 2012 - 08:44 AM
in
General
I suppose my only gripe really is that people often take it upon themselves to point out that they have "hacked" a system in an incredibly obnoxious way, usually in a way that degrades the aforementioned system, whether it works well or not.
Idk, maybe it's more of a silent majority sort of thing where I've only had experience with those more obnoxious "hackers".
#57187 Why do you hack?
Posted by
ben657
on 06 December 2012 - 08:59 PM
in
General
Whilst browsing the forums and playing on various CC servers, it seems that a worryingly large amount of people are obsessed with "hacking" (in the loosest sense of the word, given that we're playing minecraft) peoples programs and computers. I mean I can understand it to a certain extent in real life, there is actually something to gain from it generally, whether information, money, or even blackmail of sorts. I can even understand it in CC if someone says "This program is completely secure, you can't break it" that's basically a challenge to prove them wrong.
But why when somebody releases a perfectly innocent program, no claims of super-security or general awesomeness, do you go and say "Hacked it straight away, needs more security". No it doesn't, it needs people like you to realise that it's just a game and hacking a program doesn't really matter... especially if you aren't even on a server with the person using it to annoy them by hacking!
/rant
tl;dr Why do you hack CC programs?
#55695 [CC: 1.48] CCLan 1.2, lan cables!
Posted by
ben657
on 01 December 2012 - 06:38 AM
in
Peripherals and Turtle Upgrades
#50713 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 17 November 2012 - 12:10 PM
in
Programs
junithorn, on 17 November 2012 - 08:39 AM, said:
Hmm, still works fine for me... Well I'm planning on doing some work on it tomorrow, so I'll make sure to have a good poke around that part of the code and see if I can come up with anything.
Is anyone else having a problem?
#50586 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 17 November 2012 - 08:31 AM
in
Programs
junithorn, on 17 November 2012 - 07:50 AM, said:
at line 24
halp?
Hmm, very odd... When does it happen? Are you trying on a monitor or just a pc?
I'm not on my computer right now, but I'll have a proper look soon once I'm on.
#50357 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 16 November 2012 - 10:21 AM
in
Programs
Cranium, on 16 November 2012 - 08:39 AM, said:
anonimo182, on 16 November 2012 - 09:41 AM, said:
Shnupbups100, on 16 November 2012 - 10:14 AM, said:
Haha thanks all!
#50322 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 16 November 2012 - 07:51 AM
in
Programs
Leo Verto, on 16 November 2012 - 07:41 AM, said:
I like your idea of running this on a monitor and pretending it was a real ant farm.
#50308 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 16 November 2012 - 06:42 AM
in
Programs
KaoS, on 16 November 2012 - 06:34 AM, said:
TL;DR great idea man, keep working at it
Thanks! Like you, I've always loved looking at turning randomness into some sort of pattern, and simple little AI's like this are great fun to make!
Your program sounds pretty cool, I'll definitely take a look through it
#50299 [wip/fun] Ant Farm [v0.2]
Posted by
ben657
on 16 November 2012 - 05:58 AM
in
Programs
Recently I've been wanting to try out some basic game AI programming, but I've had no formal education in anything like that, so I decided what better way to give it a try than in computer craft?
Update:
The ants now prefer to dig tunnels, this gives a much nicer look to the program.
Once a certain percentage of the screen is tunnel, it will reset.
Pics:

Code:
--[[
Name: Ant Farm
Author: ben657
Description: Just a simple little ant farm to test out some
AI ideas, and basic objects.
--]]
--Global variables
local tArgs = {...}
local ants = {}
local width,height = term.getSize()
local map = {}
local speed = tonumber(tArgs[1]) or 0.1
local numDug = 0
--initialisation
for x = 1, width do
map[x] = {}
for y = 1, height do
map[x][y] = 1
end
end
--Ant Functions
function addAnt(antX,antY)
local ant = {
x = antX,
y = antY,
distance = 0,
directionX = 0,
directionY = 0,
--find a direction to go in
newDirection = function(self)
self.distance = math.random(1,5)
local upLeft = math.random(1,2)
local chance = 50
if upLeft == 1 then
if map[self.x][self.y+1] == 0 then chance = chance - 25 end
if map[self.x][self.y-1] == 0 then chance = chance + 25 end
local moveUp = (math.random(0,100) < chance)
if moveUp then
self.directionY = -1
else
self.directionY = 1
end
elseif upLeft == 2 then
if map[self.x+1][self.y] == 0 then chance = chance - 25 end
if map[self.x-1][self.y] == 0 then chance = chance + 25 end
local moveLeft = (math.random(0,100) < chance)
if moveLeft then
self.directionX = -1
else
self.directionX = 1
end
end
end,
--update function for ant to choose direction and move
update = function(self)
if self.distance <= 0 then
self.directionX = 0
self.directionY = 0
self:newDirection()
end
self.x = self.x + self.directionX
self.y = self.y + self.directionY
if self.x <= 2 then self.x = 2; self.distance = 0
elseif self.x >= width - 2 then self.x = width-2; self.distance = 0 end
if self.y <= 2 then self.y = 2; self.distance = 0
elseif self.y >= height - 2 then self.y = height - 2; self.distance = 0 end
self.distance = self.distance - 1
end,
--draw function for ant to be shown on the screen
draw = function(self)
term.setCursorPos(self.x,self.y)
term.setBackgroundColor(colors.yellow)
write(" ")
end
}
table.insert(ants,ant)
end
--Game Functions
function draw()
for x = 1, width do
for y = 1, height do
term.setCursorPos(x,y)
local tile = map[x][y]
if tile == 0 then
term.setBackgroundColor(colors.black)
elseif tile == 1 then
term.setBackgroundColor(colors.brown)
end
write(" ")
end
end
term.setCursorPos(1,1)
term.setTextColor(colors.red)
write("Virtual ant farm - by ben657")
for i=1,#ants do
local ant = ants[i]
ant:draw()
end
end
function update()
for i=1,#ants do
local ant = ants[i]
if map[ant.x][ant.y] ~= 0 then
map[ant.x][ant.y] = 0
numDug = numDug + 1
end
if numDug >= (width-3)*(height-3) then shell.run(shell.getRunningProgram()); exit() end
ant:update()
end
end
--Game loop
addAnt(2,2)
addAnt(4,4)
while true do
term.setBackgroundColor(colors.black)
term.clear()
update()
draw()
sleep(speed)
end
All it does at the moment, is create two ants, which will wander around their farm, and dig up trails as they go along.
But this is only the very first step, i'm planning on having a nest with breeding and food mechanics, as well as maybe some predators.
Also, I'm looking on suggestions on what would be a nice way to interact with the farm? My main idea is to have red stone inputs which will allow you to add ants and such manually.
I suppose this could also be a good example of using basic objects, as the ants are all the same, but run different code for each of them.
Next up:
Some form of breeding to introduce new ants
#38649 Basic file IO - Learn how to save data!
Posted by
ben657
on 10 October 2012 - 11:15 AM
in
Tutorials
sidekick_, on 07 October 2012 - 04:57 PM, said:
Really? They should be in the folder you named in the file path during the tutorial. In game, load up the pc, do "ls" (no quotes), see of there's a new folder and do "cd thatfoldersname", then ls again to see if your files there.
#36413 Basic file IO - Learn how to save data!
Posted by
ben657
on 02 October 2012 - 07:04 PM
in
Tutorials
auser, on 30 September 2012 - 04:58 PM, said:
Very possible!
http://www.computerc...le-configs-v10/
Something I did a little while ago, all the codes there for it
#36406 Basic file IO - Learn how to save data!
Posted by
ben657
on 02 October 2012 - 06:46 PM
in
Tutorials
leftcatcher, on 01 October 2012 - 10:44 AM, said:
Does this program create more than one dispName and realName folder? Or does it just overwrite the previous one? Like, for example, I create the "leftcatcher" dispName and Blah for realName, and then I create "ben675" for dispName, and Blahblah for realName. Would there then be two folders in the "saves" section? One for each dispName? Or will the "leftcatcher" folder have been overwritten?
Could I get it to basically activate off a login? For example, on startup the computer will show a menu(Which I can set up easily) which says "Login" or "Create Account". We select the latter here and it starts up the program. It then ask for a Username, (which replaces the dispName here), and then asks for a Password (Replacing realName). It then basically just creates the file around he Username in the same way your program does around the dispName, and puts the Password into the file. Then, basically, in the "Login" section, it would ask for your Username and you would enter it, and it would access the file containing that username and make the Password = requiredPassword so that way you have to enter it to log in. Basically, what your program does but with a bit more added onto the ending. If your code here does in fact have the ability to create numerous folders, then it is entirely possible to have this and actually make use of it instead of it just being a one time thing. :<
Sounds like a good way of going about it
And yeah this code will work perfectly for that. Reason being, it makes a folder named saves, and in there are FILES not folders, with data in them, rather than more folders and files. But in short, yes. It'll work fine
#34147 Basic file IO - Learn how to save data!
Posted by
ben657
on 25 September 2012 - 03:13 PM
in
Tutorials
Mtdj2, on 25 September 2012 - 02:26 PM, said:
tFile = file.readAll()and acsess the first line like:
print(tFile[1])Hope I helped... Well, I think I did.
Oh that's how that works? honestly I've never used it, just sorta assumed it gives you the whole file as one string
Will add that into the OP
#33759 [Event] Castle War?
Posted by
ben657
on 23 September 2012 - 10:16 PM
in
General
Secondly, about your problem with stopping players placing blocks. Not so long ago, I did a fair amount of programming for my old bukkit server, writing plugins, and I was just thinking I could probably come up with something to sort that problem.
Also, I might be able to automate the system a little, with players being able to queue up for a game and get sent there, and the arena being fixed at the start of each game.
So the offers there, I'd love to help get this idea going! Just PM me if you'd like more info
#33685 Basic file IO - Learn how to save data!
Posted by
ben657
on 23 September 2012 - 06:14 PM
in
Tutorials
Sariaz, on 23 September 2012 - 07:22 AM, said:
Yeah, like with printing to the console, writeLine puts a line break at the end, and you can use file.Write to just append onto the current position. Hope that helps
#32951 Config API - Easily make user editable configs! [V1.0]
Posted by
ben657
on 20 September 2012 - 05:57 PM
in
APIs and Utilities
viluon, on 20 September 2012 - 11:34 AM, said:
API config is already beign loaded parrallel:22: login.als:35: attempt to index ? (a nil value)my code:
--START>Load files--
startInterface=function()
local function reprintLoadAnim(anim)
term.clear()
term.setCursorPos(1,1)
print("Loading local user account database...")
write(anim)
sleep(0.1)
end
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Loading local user account database...")
write("-")
sleep(0.2)
local counter=0
while true do
reprintLoadAnim("")
reprintLoadAnim("|")
reprintLoadAnim("/")
reprintLoadAnim("-")
if counter==20 then
break
end
counter=counter+1
end
term.clear()
term.setCursorPos(1,1)
end
--START>End of first part--
--START>Second part>load files--
load=function()
os.loadAPI("/apis/config")
config.load("cfg","test.cfg")
config.writeVal("loaded",true)
config.writeVal("Guest","1234")
config.save()
end
--START>End of script--
--TODO>MULTITASK>Run startInterface() & load() functions at the same time, wait for completion--
parallel.waitForAny(startInterface, load)
--Set variables--
local w,h=term.getSize()
By the looks of it, you put the API in the rom/Apis folder right? If so, you don't need to call os.LoadApi(), it auto loads anything in that folder so it's trying to load something already in memory. Hope this helps
- ComputerCraft | Programmable Computers for Minecraft
- → ben657's Content


