From df7eed827225d299f442cdf52a5fb1651fb23d5c Mon Sep 17 00:00:00 2001 From: davhojt Date: Fri, 10 Jun 2022 03:08:02 +0300 Subject: [PATCH] docs(tron) change URLs --- subjects/tron/README.md | 23 +++++++++++++----- subjects/tron/audit/README.md | 45 +++++++++++++++++------------------ 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/subjects/tron/README.md b/subjects/tron/README.md index feb042a5..232cca11 100644 --- a/subjects/tron/README.md +++ b/subjects/tron/README.md @@ -30,17 +30,28 @@ You will need to create a public repository with the name `tron`. Next you need - Once no players can make a move the player with the biggest score wins +### Useful files +- [index.html (Game Engine)](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/game_students/index.html) + +- [hard.js](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/hard.js) +- [license-to-kill.js](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/license-to-kill.js) +- [random.js](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/random.js) +- [right.js](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/right.js) +- [snail.js](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/snail.js) + + ### How to write your AI -- Copy the code on the file [random.js](https://raw.githubusercontent.com/01-edu/public/master/subjects/tron/ai/random.js) to your file, `ai.js` -- You may now edit the `update` function which is called each turn +- Create `ai.js` at the root of your repository. +- Copy the contents of `random.js`, and paste it to `ai.js`. +- You may now edit the `update` function which is called each turn. > ⚠️ Do not rename the `update` function ⚠️ \ > as it's the function that the worker will try to run to test your AI. ### How to test your AI - -- You may test your ai locally. For that, create a folder and give it a name. Inside the folder you created, insert this file [index.html](). +**AI AT ROOT** +- You may test your ai locally. For that, create a folder and give it a name. Inside the folder you created, insert this file `index.html`. - After that, create a simple web server by running the following command: ```sh @@ -63,9 +74,9 @@ xdg-open 'http://localhost:8000' - You can add a local file by specifying the relative path. - You can add a online raw file by specifying the url to that file. -A example of a url with local files using the default AI `random.js` against the AI `hard.js` would be `localhost:8000/?seed=1636444665&ai=random.js+hard.js`. +A example of a url with local files using the default AI `ai.js` against the AI `hard.js` would be `http://localhost:8000/?ai=hard.js+ai.js&seed=2077349364`. -A example of a url with online files would be `localhost:8000/?seed=1636444665&ai=https://dev.01-edu.org/git/root/public/raw/branch/master/subjects/tron/ai/hard.js+https://dev.01-edu.org/git/root/public/raw/branch/master/subjects/tron/ai/random.js`. +A example of a url with online files would be `http:?/localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/hard.js+ai.js`. Note: You can test a local AI against and online one. diff --git a/subjects/tron/audit/README.md b/subjects/tron/audit/README.md index 2af085e3..5927af81 100644 --- a/subjects/tron/audit/README.md +++ b/subjects/tron/audit/README.md @@ -1,45 +1,44 @@ #### Functional -##### Does the AI not crash because of too much usage of CPU? - -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +##### Open the project, and delete `index.html` if it exists. -##### and [random.js](). Try three times, changing the seed each time. The best of three, wins +##### Copy the game engine ([index.html](https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/game_students/index.html)) to the root of the student's project. -###### Did the audited AI won against `random` AI? +##### Create a simple web server by running the following command: -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +```sh +$ python3 -m http.server +Serving HTTP on :: port 8000 (http://[::]:8000/) +``` -##### and [right.js](). Try three times, changing the seed each time. The best of three, wins +##### Open a web browser, and go to the specified port. In the above case, that will be http://localhost:8000. -###### Did the audited AI won against `right` AI? - -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +##### Does the AI not crash because of too much usage of CPU? -##### and [snail.js](). Try three times, changing the seed each time. The best of three, wins +##### Battle `ai.js` versus `random.js`. It is best out of 3. Delete the seed before each go. http://localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/random.js+ai.js -###### Did the audited AI won against `snail` AI? +###### Did `ai.js` win `random.js` at least 2 times out of the 3 games? -###### Does the code avoid [deep nesting](https://testing.googleblog.com/2017/06/code-health-reduce-nesting-reduce.html)? +##### Battle `ai.js` versus `right.js`. It is best out of 3. Delete the seed before each go. http://localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/right.js+ai.js -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +###### Did `ai.js` win `right.js` at least 2 times out of the 3 games? -##### and [hard.js](). Try three times, changing the seed each time. The best of three, wins +##### Battle `ai.js` versus `snail.js`. It is best out of 3. Delete the seed before each go. http://localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/snail.js+ai.js -###### Did the audited AI won against `hard` AI? +###### Did `ai.js` win `snail.js` at least 2 times out of the 3 games? -#### Bonus +###### Does the code avoid [deep nesting](https://testing.googleblog.com/2017/06/code-health-reduce-nesting-reduce.html)? -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +##### Battle `ai.js` versus `hard.js`. It is best out of 3. Delete the seed before each go. http://localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/hard.js+ai.js -##### and [license-to-kill.js](). Try three times, changing the seed each time. The best of three, wins +###### Did `ai.js` win `hard.js` at least 2 times out of the 3 games? -###### +Did the audited AI won against `license-to-kill` AI? +#### Bonus -##### If you have an AI +##### Battle `ai.js` versus `licence-to-kill.js`. It is best out of 3. Delete the seed before each go. http://localhost:8000/?ai=https://((DOMAIN))/git/root/public/raw/branch/master/subjects/tron/ai/licence-to-kill.js+ai.js -##### Modify the link so that you use the AI from the user that is being audited [ai.js]() +###### +Did `ai.js` win `licence-to-kill.js` at least 2 times out of the 3 games? -##### and **your AI**. Try three times, changing the seed each time. The best of three, wins +##### If you have an AI, and are prepared for battle. Modify the URL to battle against your AI. Best out of 3. ###### +Did the audited AI won against your AI?