ermiyaeskandary / Slither.io-bot

Just for fun and AI. Written in Javascript, this is a project which the aim is to make a computer play against humans inside a human-driven game, which is in this case Slither.io. The goal is simple - try and make the snake live and get as long as possible.
Mozilla Public License 2.0
193 stars 124 forks source link

An automated test #291

Open K00sKlust opened 8 years ago

K00sKlust commented 8 years ago

from the wiki:

To test the bot, which is required for new commits or pull requests , simply run it for a long time - 30 games is the minimum but more is appreciated. Scores will be collected in the bot.scores variable, which can be viewed with the browser's developer console.

It would be much easier to be able to run a standard test (sort of benchmark), which, for example:

for both the new and the current version of the bot.

I was thinking of a small piece of software to put in the code, and the software creates several windows, and displays the average stats from all windows together. (Could this been done using Electron?)

Maybe we could extend it later to something like discussed in #101

ermiyaeskandary commented 8 years ago

@K00sKlust Have a go at it! Sounds like a good idea!

ermiyaeskandary commented 8 years ago

Related to #265

ChadSki commented 8 years ago

What I think would be even easier is a "testing mode" toggle for disabling the drawing. Electron is waaay too complicated; it's not going to make our lives easier compared to manual testing.

A "testing mode" built into the bot could be written up pretty quickly, and give us a better test experience right away.

Seple commented 8 years ago

A "testing mode" built into the bot could be written up pretty quickly, and give us a better test experience right away.

Remote logs users statistics?

ChadSki commented 8 years ago

Well... no I wasn't thinking of automatically logging users' scores (in fact I wouldn't want to do that feature).

I was thinking of a new menu toggle (what letters are still unused? let's say 'R' for the sake of argument) that disables drawing the graphics. This helps testing, because when the drawing is disabled you can run more bots without overloading the CPU.

Seple commented 8 years ago

I understand Thank you for explanation :+1:

ermiyaeskandary commented 8 years ago

@ChadSki For the testing key, we could disable graphics - yeah that's a good idea How would we "comment it out" ? Stupid question nvm - we can just set it to null. Any other easier way?

ChadSki commented 8 years ago

I think we should leave the variable original_redraw alone because then the name remains accurate.

We can make a new variable redraw_graphics_fn that's usually set to original_redraw, but sometimes is set to an empty lambda.

When the key toggle is pressed, it swaps the current redraw_graphics_fn for the other one, turning graphics rendering on or off.

clemens-tolboom commented 8 years ago

I skimmed with http://phantomjs.org/ next ran

var page = require('webpage').create();
page.open('http://slither.io/', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('slither-io.png');
  }
  phantom.exit();
});

resulting slither-io

Unfortunately I'm not sure how to inject our code.

(my 2 cents)

tjorim commented 8 years ago

I would recommend to do it like https://github.com/ErmiyaEskandary/Slither.io-bot/commit/7da5f7e90bdf920ca6e39232a4b6619f41a6e97b maybe.

I skimmed with http://phantomjs.org/ next ran

var page = require('webpage').create();page.open('http://slither.io/', function(status) { console.log("Status: " + status); if(status === "success") { page.render('slither-io.png'); } phantom.exit(); });

resulting [image: slither-io] https://cloud.githubusercontent.com/assets/371014/15831590/a7d1e208-2c1e-11e6-962d-db7492c4ac05.png

Unfortunately I'm not sure how to inject our code.

(my 2 cents)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ErmiyaEskandary/Slither.io-bot/issues/291#issuecomment-224032918, or mute the thread https://github.com/notifications/unsubscribe/ABPCHADIy8oGO7cnrglJG47P7QWoO5A1ks5qJFxtgaJpZM4IuJ9c .