« first day    last day (27 days later) » 
00:00 - 16:0016:00 - 00:00

00:35
I’m tempted to write a bot which attempts to mess with “Living on the Edge” just so that its name can be a border control pun.
But that would be mean
LOL
Just make the bot lose quickly, and it won't be mean at all. Just funny.
01:29
What will happen if you use the botnotes.getdata(key) when you haven't stored anything yet?
01:43
Returns null
I am writing a physics based bot based on protons :P
Since I didn't know what would happen I built the getdata into a try catch finally statement
Might want to fix that
It still will work. I just didn't know what would happen since I try to access the data in the first round. So I used try catch to default on failure to retrieve info.
02:05
Oh, good.
It treats coins (including those held by other bots) like other protons if it ends up right next to something it can consume strong nuclear force takes over and it instantly moves to that spot and drops all velocity.
Interesting way to go about it
Effectively it acts to mostly run away but eats things if it gets close to them by accident
It even runs away from most coins
Ahh, money! Run!
The coins smell weird!
I'm running into issues with a multidimensional array...neither indexOf nor includes work, so I'm having to think outside the box
02:45
I made a arrayIndex() function that accurately on multidimensional arrays
03:23
I think I'm finished!
03:34
Testing with Goldilocks and Katamari
03:49
Hmm, coins are mysteriously vanishing!
 
2 hours later…
05:24
Since there doesn't seem to be any limit on number of bots per user, can we create two (or more) bots that co-operate with each other?
@Night2 Great idea...
Is it guaranteed that each bot appears at least once in the field?
Based on the game rules written in the original question, on the first round, every bot is supposed to be on the arena: "The arena's side length is calculated with 4 + botCount. When placing bots in the beginning of the game, random places are chosen. The system ensures that no bots start in the same space, or next to each other."
06:26
Once a bot dies, the arena becomes smaller?
There is also no scoring function mentioned. Does only the number of wins count?
The arena size is determined at the start and does not change afterwards
 
5 hours later…
12:06
Having looked at this challenge with my morning eyes (although I'm not very well rested) it looks as though there are still some problems for anyone who wants to compete in this challenge.
I'm not really sure what to expect - will the controller end the simulation in 10,000 moves, or 5 minutes? I feel that the post is written more or less from the top down, but some of the basic instruments (my bot will do this, my bot will not fail to win for this reason) are not clearly stated in the OP. I think this is why another user complained this should be worked out before posting, but the post has attracted a lot of attention and it really should be finished now.
12:31
Also, are bots allowed to poll the controller for any personal information (such as their location, or the number of coins they have?) Anyone could code a good way to keep track of states, but that may not be the best option.
Not 10,000 moves, 10,000 rounds.
The function parameters include all bot locations and coin amounts, your bot's coin amount, location, and arena size, as well as coin locations.
Store information (Or states) with botNotes.storeData(key, value) and botNotes.getDtaa(key)
Controller still has a few bad errors, but it's mostly finished. If anyone could figure out why coinLocation shrinks every turn, I'd be happy
Good news: There will soon be a 100-point bounty!
Someone's going to get very rich off of this question
13:00
That's fine: bounty doesn't make me rich. I will investigate the controller when I get a chance.
It has a few odd bugs, and I'm going to add 1 more thing.
Currently, list of bots includes your bot.
I'll remove that
But first, I need to figure out the coinLocation bug.
@RedwolfPrograms My first comments this morning were to clarify the challenge, not the situation of the challenge. I do not have a bot posted, so you do not have my bot. I will await a finished version of the controller before posting, because it might not be worth my time otherwise (I have a very generic algorithm written, but I want to understand JavaScript, and that would require some time).
@theREALyumdub Which language is it written in?
By "list of bots includes you bot" I meant that the second parameter for the function included the bot that was requesting the list of other bots, if that makes sense
In about 30 minutes (After breakfast), I'll get to work on debugging the controller.
I put the updated version in github under controller2.js in the link on the KoTH page
14:00
@RedwolfPrograms Can you make the gists public?
I could perhaps offer some help with with looking for the bugs, if still needed.
Still needed.
OK, don't expect me to find anything, but I'll have a look at it.
It works fine, until you test it with Katamari. I thoroughly checked, and Katamari has no bugs.
Maybe it has to do with length?
Hold on...I may have just discovered something!
[Moans in annoyance]
I found the problem
14:10
Great :—).
What was it?
I'm passing the array as a parameter, and it's editing the global variable
Inside the function
All I need to do is copy it
I thought JS would pass copies?
(in fact, I was thinking if this could be a cause, and looked it up, and found that JS indeed passes by value.)
Supposedly, but I ran some tests:
var globalvar = [[5,5],[4,4]]
function corruptValue(input) {
input.push('evil stuff')
(though I'm probably missing something, having no experience with JS whatsoever.)
}
globalvar //[[5,5],[4,4],'evil stuff']
I think if it's an object (Or array), it passes the array/object itself
14:14
Hmm... I see. The array is probably described by a reference, which is then happily passed by value.
Any object you pass (including arrays) should be a copy, otherwise bots can change them.
And the bots are changing them
Which I am going to fix
In JS, arrays are also some kind of object and are passed as a copy of reference: stackoverflow.com/questions/13104494/…
Yeah, I used .slice() to copy the array
Now, it works fine.
I see. // Good to hear that.
14:16
I feel so stupid
Also I would suggest that you create a scope and keep everything inside it, if you keep them global, bots could still change them. Right now all of your important variables look to be global.
But I also feel good, because I'm almost done testing
@Night2 I don't think that will be a problem
I'm building 2 bots now, just to test bot collisions
It could be a problem I think. Maybe someone else will have an innocent idea to make a "coinLocations" variable for something, and interesting stuff happens. (Or not so innocent idea, cf. the various DarkBots, HypnoBots et al. that always appear at KotHs :—).)
Okay. So, what do I do?
Create a sort of botData.getCoinLocations()?
And store the data inside?
Honestly, I don't know. I started looking into JS yesterday to be able to write my bot.
(Actually I don't think you need to do anything about it if you edit the challenge post and ask people not to use these variable names.)
14:23
That's what I was about to do
Also, you can just make your bot in another language and have me translate
You can force a local variable in javascript, I think, using let instead of var
By the way, hi! I haven't made any bots yet, I'm still thinking of a strategy
Well, we need more smart hunting robots
Otherwise, the rounds will be too long
I think that BaitBot is the pinnacle of hunting bots.
But there's still probably ways to improve
I was thinking of making a bot that tries to evaluate the strategies of other bots then moves to intercept when possible
14:25
You cannot ever eat another bot if that bot is purposefully running away from you.
Yes, but most aren't designed to purposefully run
I think you can if you corner it and predict which way it will try to avoid you
You can most definitely do that. But you won't be able to prevent it from running.
True
14:27
Even from a corner, there are 2 non-adjacent spaces to run away to.
So the running bot will know where to run even before you make the final move.
Like I said, predicting where it will go would be key (if possible). Get it into the corner so that you're diagonal from it, then it's a 50/50 (or better) chance
Most likely, the bot will be cornered by multiple larger bots
The arena will be at least 20 by 20
No, at least 25 by 25
Of course, having more bots makes it way more complicated.
I had an idea for adding a little more "smart" to a hunter: Bait bots that are only slightly stronger than yours, then collect a coin when they get close and hope you can chase them down
Again, though, that relies on hunting it down
:—).
(By the way, even if you approach the cornered bot diagonally, the bot can first stand still, then safely run away.)
14:31
You could build 2-3 bots that can work together, then use them as an army to herd them into a corner
If working together is a possibility, then yes, sure.
But there's no way for bots to communicate with one another
There's always a way ;)
They can use global variables: window.whatever.
14:32
Well, yeah
But I'm not sure if I want that allowed
Oh, I was just thinking of having them perform a short sequence of predetermined moves ahead of time
Yes
Like 2 bots meet the first
Then attack one since they all have the same algorithm
Yes, that's the more interesting way.
Bots that start with up-down-up-down-up would be marked as friendly, for example
Like instead of searching from the bot itself, from the leader bot
Yes
Or maybe add a way for the bots to read each other's names?
So that you could do bots[2][3] to get the name, and check if it is a friend?
14:34
I was looking at the rules to see if we could do that, but as written, you can't
I think that's probably for the best, as it prevents people from making counter-bots
It's always disappointing to see people win KoTH using something written specifically to counter each of its enemies
The up-down-up-down thing would work
@N.P. Yeah
Even easier would be to just do 'none' twice at the beginning. It's unlikely anyone else would do that
I could create 5 protector bots and 1 main bot to work as a team to make the main bot as strong as possible on start. Allowing bot teaming opens an unlimited world of possibilities which probably won't be nice.
14:37
I think if you can write them well enough to coordinate properly, you deserve to do well.
Is it specified anywhere how the initial placement is determined?
Completely random (Each spaced by at least 1, though)
Okay, so each bot is placed at the center of an isolated 3x3 square?
Similar to how coin placements work?
Yes
But coins only rely on not being next to bots.
They can be next to each other, or even in the same space
14:39
Ooh, interesting...
Otherwise, the while loop would loop infinitely in unlucky situations with only 1 or 2 spots where coins could go
Nobody has designed a bot that recognizes coins in the same square as worth more
Did you say how you're going to handle translating from python to javascript?
My bot already works for coins in same place as well.
Well, control flow and loops work about the same, so I'll do it by hand
Alright, I think I'm going to write mine in python then
14:40
@Night2 Oh, cool. I didn't know that
@N.P. SOunds fine
So, am I allowed to create teaming bots?
Yes, but they must all be different (No copies)
Example: Leader, bait, and hunter
And no global variables, right?
It would also be nice if you specify these rules in the main post and also set a deadline so we know how much time we exactly have
14:43
Bots can't communicate with each other directly, they can only use in-game actions to talk
Also rules about using global variables or any sort of variables out of botNotes would be nice to be known.
Okay, thanks. Deadline is Wednesday, August 15
@N.P. I still can read other bots storage, not sure if that is called direct communication or not.
Actually, you can't
botNotes aren't keyed to specific bots?
Oh, they are
Good
14:46
Eveyr bot could have a different value for one key, and every bot would be functional and not edit the oter bot's data
I assumed it would just be a dictionary of dictionaries, where the first level is bot IDs and the second level is the actual data
The key/value info is stored in botData[bot].kvpData[value]
if botData[...].kvpData[my_special_key_for_bot_1] exists, I know which bot this is ;)
You could run it so that:
bot1 calls botNotes.storeData(key, value) => private botNotes[bot1][key] = value
Okay, I'm encrypting the data
YOU SHALT NOT PASS
14:50
bot2 calls botNotes.getData(key, value) => nothing, because botNotes[bot2][key] is not defined
@N.P. Actually, that's what I did
boteNotes holds nothing but the two functions
Okay, awesome
botData holds the key/value pairs, as well as the coin and location data for every bot
But botData is global, so I can access it in my bot.
I think accessing anything outside of that would be considered cheating
14:52
Yes, it is
"You may not store data any other way."
You need to specify these rules in your post then.
Says that in the rules
Oh
I didn't see that, must be added on an edit
But still
I'm not storing anything outside of that
I am reading something in that case.
ou may not store or access data any way, other than that which is provided through the parameters and botNotes
I changed "You may not store data any other way."
to "You may not store or access data any way, other than that which is provided through the parameters and botNotes"
14:54
OK, that is good now
"You may not store or access data any way other than the parameters and the provided botNotes functions"
Since someone could make the argument that "hey, I'm accessing botNotes! (just not mine)"
But it's not stored in botNotes, it's in BotData
Now the only way to detect your team bots will be signaling in the game moves.
Which makes it fun
It's a challenge
Not a massacre
Is the order of the bots guaranteed to be the same?
In the parameters, I mean? (and yes, I know sometimes some will be removed)
14:56
No, since dead bots are taken off the list
But the order is the same
Okay, so 1, 2, 3 and 2 dies will be 1, 3
Thank yoiu
It could also be nice to put a limit on how many bots each user can have
I just need to complete the final part of the controller, and I'm going to test every bot and give them feedback on if they made any errors.
@Night2 Well, the "Must be original" will keep people from making huge armies
Plus, the more bots the bigger the arena the better it is to watch
I may even build a graphic output, and put a few rounds on youTube
3
14:59
I might make a port of this and just let it randomly spawn bots in then just keep it running in the background of my computer
It's like a digital aquarium
/ coliseum
LOL
But most aquariums don't have death-battles
Oh yeah, /coliseum
I'm going to make a bot named Purple People Eater (Does it eat purple people, or is it purple and eats people?)
I bet I could use machine learning to train a bot...
LOL, that's perfect
I want that
@BetaDecay Where is the Blackhat? ;)
I was also considering porting the controller, and/or adding graphic output. Would really help with bot testing.
15:06
@BetaDecay I told my sister she needed a more interesting pet than a goldfish
@Ramillies I'm going to build a graphic output, but you can build one too. Mine will just be an HTML5 canvas.
That's what mine would be too. But only after I'd read through the canvas docs, so if you're going to do it, then I won't.
@RedwolfPrograms Which environment are you going to use for the actual run of bots? Node.js?
@Night2 No, web browser
Be careful with CSRF attacks then, one bot could actually try to harm you instead of playing the game :D
@Night2 But I'm reading through them all first in order to make sure nobody breaks the rules
15:12
Do you have a rule to ban loading external resources?
"Cannot access information except from parameters and botNotes"
You could load it, but not store/retrieve any data at all
Well, if I can load something from internet, it can contain any code. I could pretend that I'm loading a math library from http://something.something/something.js and that URL could be set to return a different code on 1000th request.
It'll be a lot harder to make sure there's no rule breaking - okay, yeah
External resources are information, right?
I think loading/accessing any 3rd party or remote resource should be forbidden.
Well, your still getting information from a remote library/resource/3rd party
15:17
I think it already is. You'd be accessing information that is not within the parameters or the botNotes
Indeed
I've got a tricky part of the program to figure out
Oh?
I'd prefer not to use a loop, but I think I'll have to.
What is it?
It's for checking which two bots ran into each other. It doesn't store the name of the first bot. Wait...got an idea
15:20
@N.P. Does that make this line of code illegal? var s = document.createElement('script'); s.src = 'http://something.com/js.js';document.head.appendChild(s);
I believe so
Cool, I set my screensaver to a Redwolf! Now just to add in a computer...
@RedwolfPrograms You could store each bot in a dictionary after each movement where the coordinates are the keys, then check for any key whose value is a list with more than one element
There's probably a better way to do that though
Actually, I already had an array. As it looped through the bots, it added the location to the array. But if it was already there, it knew it was in the same space as another bot. But it didn't know the name of the bot that had previously put it's coordinates in the array. I just made a new array with the names of the bots in the same index as the location in the first, if that makes sense.
So what happens when there's more than 2 bots in the same square?
15:25
It's complicated
But I figured it out.
lol
I'm just concerned that if it's not implemented properly you might end up with something like the following:
Bot1 (size 20) moves into square
Bot2 (size 24) moves into square, eating Bot1 and changing size to 31
Bot3 (size 30) moves into square, is eaten by Bot2 since the order was applied improperly
Whereas if they all move into the square on the same turn, Bot3 should win
No, after it calculates all the stuff for the same sapce, it puts the bot names in an array. Then, it continues through the array. If it finds another bot with the same coordinates, it just adds its name to the array of names. After all the bots have been checked, it does the calculations for the winner.
Okay, awesome, thank you
All the movements are applied after they are calculated, so that there is no advantage for being the first bot to move.
Uh oh
The arena stays the same size when bots die, right?
@RedwolfPrograms I saw your comment about some bug that makes Katamari vanish coins
Do you mean it loses its own coins, or messes up the global coin locations ?
It turns out that it was caused by accidentally passing a - oh, forgot the word. Non-static parameter
The word starts with an R, I just can't remember it
An array object rather than a clone of the array?
Oh it was passing a reference?
Yes
Yes, passing a refernce
So it would remove elements from arrays mysteriously
15:33
Hmm, it still shouldn't be doing that
All Katamari does with the coins array is sorting it
Hmm, well, might wan to check that
that does mess with the order which is itself bad
but it shouldn't vanish coins
yeah, I'll take a look, thanks
It could be caused by the sort messing with my code
No! The code that keep bots from starting bnext to each other isn't working!
Is the github up to date?
Not really.
OH!
Just found the problem
It used a forloop to check...wait no, never mind
15:40
When you get a chance, can you update the git?
I'll do that now
I updated it, note that it has a few console.log()s and 2 built-in bots for testing purposes
Thank you
Wait...maybe I'll do 2 bounties, 1 50-point for 2nd, and one 100-point for 1st
With 30 upvotes (almost), I have enough reputation
Just gave you the thirtieth!
Yaaaay, thanks!
15:45
Are the 3x3 areas around each bot allowed to overlap when the bots are spawning in?
So, a bot could start with exactly one space between it and another bot?
Or does each bot start with a 3x3 area around it that cannot overlap with any other bot's 3x3 area?
They can overlap
It's 1-space padding between a bot and anything else (Except the wall)
That's what I'm having issues with
Does the botPos array hold arrays of positions?
So [[1, 5], [3, 15], [2, 0]]
Yes, and [-2,-2] for dead
Interesting designation for dead things
It was [-1,-1], but then coins can't generate in the northwest corner
15:52
I was a bit astonished since you store death by two independent means: the position and the alive variable in the botData object. :—).
(but I guess setting this weird position solves a lot of things automagically so you don't need to check for aliveness all over the place)
It's necessary for it to be that way, since botPos is used for coin generation only, while botData is for everything else
Hello, @fəˈnɛtɪk
I see.
function getValidPosition() {
  let pos = 0
  while (pos == 0) {
    let x = randInt(0, arenaSize-1)
    let y = randInt(0, arenaSize-1)
    for (let i = 0; i < botPos.length; i++) {
      let thisX = botPos[i][0]
      let thisY = botPos[i][1]
      if (abs(thisX-x) > 1 || abs(thisY-y) > 1) {
        pos = [x, y]
      }
    }
  }
  return pos
}
ack
Hold on
function getValidPosition() {
  let pos = 0
  while (pos == 0) {
    let x = randInt(0, arenaSize-1)
    let y = randInt(0, arenaSize-1)
    let allowed = true
    for (let i = 0; i < botPos.length; i++) {
      let thisX = botPos[i][0]
      let thisY = botPos[i][1]
      if (abs(thisX-x) <= 1 && abs(thisY-y) <= 1) {
       allowed = false
      }
    }
    if (allowed) {
       pos = [x, y]
    }
  }
  return pos
}
This might work
I have

do {
r = [randInt(0, arenaSize - 1), randInt(0, arenaSize - 1)];
console.log(r);
for (n = 0; n < botPos.length; n++) {
x = botPos[n][0];
y = botPos[n][1];
if (Math.abs(x - r[0]) <= 1 && Math.abs(y - r[1]) <= 1) {
console.log('loop again')
close = true;
} else {
console.log('done looping')
close = false;
}
}
} while (close);
b.loc = r;
botPos[i] = r;
Looks like basically the same logic
15:57
Exactly, but I'm getting bots everywhere
Try mine and see if it does the same thing?
@RedwolfPrograms How many bots are you running with?
I tried a bunch of runs with the default 2 bots, and didn't get them spawning close to each other
15:58
I sprinkled a few console.logs inside the loop, and it did correctly reject locations that were too close
and end up with a valid botPos array
I know, but once I take the console.log()s away, it seems to break again!
where does it break, how are you figuring that?
also, what sort of values are you getting for the coordinates?
00:00 - 16:0016:00 - 00:00

« first day    last day (27 days later) »