Nie dopracowany agent
This commit is contained in:
parent
990c06129e
commit
e123508d38
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Inteligentny wózek</title>
|
||||
<link type="text/css" rel="stylesheet" href="styles.css">
|
||||
<script type="text/javascript" src="script.js">
|
||||
<script type="module" src="script.js">
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
@ -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']
|
||||
|
||||
function start(){
|
||||
ponumerujPola();
|
||||
pokolorujRegaly();
|
||||
umiescAgenta();
|
||||
}
|
||||
|
||||
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
12
objects/Agent.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user