Nie dopracowany agent

This commit is contained in:
Tomek 2020-04-06 15:21:40 +02:00
parent 990c06129e
commit e123508d38
3 changed files with 22 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Inteligentny wózek</title> <title>Inteligentny wózek</title>
<link type="text/css" rel="stylesheet" href="styles.css"> <link type="text/css" rel="stylesheet" href="styles.css">
<script type="text/javascript" src="script.js"> <script type="module" src="script.js">
</script> </script>
</head> </head>

View File

@ -1,8 +1,11 @@
import Agent from '../objects/Agent.js';
var regaly = ['1-1', '1-3', '1-4', '1-6', '1-7', '1-9', '2-1', '2-9', '3-3', '3-4', '3-6', '3-7', '4-1', '4-9', '5-1', '5-3', '5-4', '5-6', '5-7', '5-9'] var regaly = ['1-1', '1-3', '1-4', '1-6', '1-7', '1-9', '2-1', '2-9', '3-3', '3-4', '3-6', '3-7', '4-1', '4-9', '5-1', '5-3', '5-4', '5-6', '5-7', '5-9']
function start(){ function start(){
ponumerujPola(); ponumerujPola();
pokolorujRegaly(); pokolorujRegaly();
umiescAgenta();
} }
function pokolorujRegaly(){ function pokolorujRegaly(){
@ -22,3 +25,9 @@ function ponumerujPola(){
} }
} }
function umiescAgenta() {
const agent = new Agent(3, 0);
id = agent.getid();
document.getElementById(id).className = 'regal';
}

12
objects/Agent.js Normal file
View File

@ -0,0 +1,12 @@
class Agent {
constructor(x, y){
this.xField = x;
this.yField = y;
}
getid(){
return this.xField + "-" + this.yField;
}
}
export default Agent;