Browse Source

first draft of tron subject and audit questions

content-update
Christopher Fremond 4 years ago committed by Clément
parent
commit
5f196927fe
  1. 40
      subjects/abort.en.md
  2. 41
      subjects/tron/tron.audit.en.md
  3. 80
      subjects/tron/tron.en.md

40
subjects/abort.en.md

@ -1,40 +0,0 @@
## abort
### Instructions
Write a function that returns the median of 5 five arguments.
### Expected function
```go
func Abort(a, b, c, d, e int) int {
}
```
### Usage
Here is a possible program to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
middle := piscine.Abort(2, 3, 8, 5, 7)
fmt.Println(middle)
}
```
And its output :
```console
student@ubuntu:~/[[ROOT]]/test$ go build
student@ubuntu:~/[[ROOT]]/test$ ./test
5
student@ubuntu:~/[[ROOT]]/test$
```

41
subjects/tron/tron.audit.en.md

@ -0,0 +1,41 @@
#### Functional
##### clone this repo : https://github.com/01-edu/tronAis
##### copy the **GITHUB_LOGIN**.js of the audited inside the /ai folder
##### as such /ai/**GITHUB_LOGIN**.js
##### run this command
```sh
http-server tronAis/
```
if http-server is not installed do this command:
```sh
npm install -g http-server
```
##### go the link created by the http-server, open the inspector and **disable the cache**
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **Frenchris-right-basic**
###### Did the audited Ai won against the Frenchris-right-basic Ai?
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **Frenchris-right**
###### Did the audited Ai won against the Frenchris-right Ai?
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **Frenchris-snail-basic**
###### Did the audited Ai won against the Frenchris-snail-basic Ai?
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **Frenchris-snail**
###### Did the audited Ai won against the Frenchris-snail Ai?
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **AI5**
###### Did the audited Ai won against the AI5 Ai?
##### modify the link so that the users are the audited **GITHUB_LOGIN**
##### and **AI6**
###### Did the audited Ai won against the AI6 Ai?

80
subjects/tron/tron.en.md

@ -0,0 +1,80 @@
## tron
### Ojectives
In this project you will have to create your own Tron Ai snake
### Getting started
First, clone this repo : https://github.com/01-edu/tronBlank
then execute the command below.
```sh
http-server tronBlank/
```
if http-server is not installed do this command:
```sh
npm install -g http-server
```
### Controls
- `space` toogles autoplay
- `right arrow` plays one move
- `up arrow` increases the autoplay speed
- `down arrow` lowers the autoplay speed
- `R` reloads the same play
- `S` loads a new play (new seed)
### Rules
- Your Ai has to move every turn *(it can not stay still)*
- Every time the Ai moves somewhere the Ai leaves a color trail.
- the Ai can only move to a blank tile.
- the Ai can not move out of the map *(100 x 100)*
- the Ai can only move to its `left`, `forward` or its `right`.
*(Moving `backward` is suicide as it would hit its own trail !)*
- If too much CPU power is required to decide where to go, the Ai dies.
- If two Ais moved to the same spot, both of them die.
- **The Ai has to survive as long as it can.**
### The game ends
- Once no players can make a move
- The player with the longest trail wins
### How to write your AI
- Copy the file [/ai/random.js](https://github.com/01-edu/tronBlank/blob/master/ai/random.js) to /ai/**GITHUB_LOGIN**.js
- You may now edit the `update` function which is called each turn
### How to test your AI
- Suppose the link provided by http-server is : `http://127.0.0.1:8080/?seed=somevalue&users=random`
- You need to add your ai as a user in that link,
- Example: if your ai file's name is **/ai/Frenchris.js**
the link becomes:
`http://127.0.0.1:8080/?seed=somevalue&users=Frenchris,random`
- Open the inspector of the browser used and **disable the cache**
- let's change the update function so that your ai only goes forward.
replace this line just before the `return` of the update function
```js
const available = coordsInBound.filter(isFree)
```
with this line
```js
const available = coordsInBound.filter(isFree).filter(el => el.direction === 0)
```
- save the file and rerun the game in the browser. If the cache was correctly disabled,
you have changed your ai behaviour from a random pick of available moves to only going
forward.
- To understand better the way of controling your AI, read the comments inside the Ai file and do a lot of testing.
- When peer-corrected, you Ai will be competing against other Ais.
Be aware that there will be the possibility for the peer-correcter to use his or her own Ai.
May the best tron win :)
Have fun and good luck.
Loading…
Cancel
Save