Live data from Hacker News

Show HN: JavaScript Battle – A daily artificial intelligence battle

javascriptbattle.com

1–10 of 43 posts

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#2
That's interesting, I like that everyone's code has to be public on github so if you get relentlessly destroyed you will at least have the chance to learn from how your opponent works.

I haven't yet tried the game itself, but the testing page mentioned on the frontpage seems rather important, and I think I'll hold off on trying the game until that is implemented.

Also I think it would be good to mention at what time (in which timezone) each day the code is pulled and the battles are run.

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#3
CoreWars but with JS and GitHub! Cool idea.

I'd be very interested in hearing about the server-side setup, especially around isolating the code so some rando doesn't "require('fs')" and do damage to the server. How are you isolating the brains from the sensitive game data and from each other? How long does a single game take to run given max users? How are you protecting against "while(true);"?

Here's a repo that looks related: https://github.com/JavascriptBattle/javascript-battle-webwor...

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#4

That's interesting, I like that everyone's code has to be public on github so if you get relentlessly destroyed you will at least have the chance to learn from how your opponent works. I haven't yet tried the game itself, but the testing page mentioned on the frontpage seems rather important, and I think I'll hold off on trying the game until that is implemented. Also I think it would be good to mention at what time…

That the code is public could easily be manipulated, by commiting minified code instead. It doesn't make it non-copyable but mostly unreadable.

There is a small testing utility (called " test_your_hero_code.js") in the repository where you can make sure your hero is working as it should. But I'm also looking forward to a proper testing page where I can see the battle.

Interesting idea however, looking forward to having some free time to trying it out fully.

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#5
post #3

CoreWars but with JS and GitHub! Cool idea. I'd be very interested in hearing about the server-side setup, especially around isolating the code so some rando doesn't "require('fs')" and do damage to the server. How are you isolating the brains from the sensitive game data and from each other? How long does a single game take to run given max users? How are you protecting against "while(true);"? Here's a repo that loo…

Thanks so much for the interest and the questions. You are correct in that the web-workers repo is related. Its the repo we use on the back end. To answer your questions in turn: "How are you isolating the brains from the sensitive game data and from each other?" - We are sandboxing each user's code in an isolated environment where a server listens for a POST request on a specified endpoint. That request carries the game data with it and after the user's code runs, the server sends back the result of that function, which is supposed to be a string (North, East, South, West, or Stay). The game data itself is update on our server, after receiving the response. "How long does a single game take to run given max users?" The games will take a maximum of 24 users, which will take a maximum of 30 minutes to run, if every user does something like "while(true)." Each server has a max-timeout setting of around 2 seconds. I hope that answers your questions and please feel free to offer any feedback. Thanks again!

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#6

That's interesting, I like that everyone's code has to be public on github so if you get relentlessly destroyed you will at least have the chance to learn from how your opponent works. I haven't yet tried the game itself, but the testing page mentioned on the frontpage seems rather important, and I think I'll hold off on trying the game until that is implemented. Also I think it would be good to mention at what time…

That's really good feedback, thank you. We are currently running the game at close to midnight, Pacific Time. As far as the testing site, that should be coming soon, but feel free to try out our temporary testing suite in the meantime. The hero-starter repo has all the instructions for that. Thanks so much for your comments and feedback!

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#7
post #4

That's interesting, I like that everyone's code has to be public on github so if you get relentlessly destroyed you will at least have the chance to learn from how your opponent works. I haven't yet tried the game itself, but the testing page mentioned on the frontpage seems rather important, and I think I'll hold off on trying the game until that is implemented. Also I think it would be good to mention at what time…

That the code is public could easily be manipulated, by commiting minified code instead. It doesn't make it non-copyable but mostly unreadable. There is a small testing utility (called " test_your_hero_code.js") in the repository where you can make sure your hero is working as it should. But I'm also looking forward to a proper testing page where I can see the battle. Interesting idea however, looking forward to havi…

Thanks so much for the feedback. As you said, we do have a temporary testing utility for users while we finish up our testing site. Hope to see you soon!

Re: Show HN: JavaScript Battle – A daily artificial intelligence battle

#9
post #8

This is great! Would ClojureScript (or other languages compiling down) do?

Thanks! ClojureScript (or Coffeescript, or anything other than JS) will not work "right off the bat", but you could compile to JavaScript on your end, then upload that compiled hero.js file to your github repository, and then THAT should work.

Hope that helps.

Post reply on HN