połaczaenie bE
This commit is contained in:
parent
f9dbc54bb2
commit
31fde0ad1b
@ -19,6 +19,9 @@ const Hero = () => {
|
|||||||
let number_of_defenders = 0;
|
let number_of_defenders = 0;
|
||||||
let number_of_strikers = 0;
|
let number_of_strikers = 0;
|
||||||
|
|
||||||
|
let shooterX = 0;
|
||||||
|
let shooterY = 0;
|
||||||
|
|
||||||
// zmienne globalne bedace danymi wejsciowymi do modelu
|
// zmienne globalne bedace danymi wejsciowymi do modelu
|
||||||
|
|
||||||
|
|
||||||
@ -60,14 +63,16 @@ const Hero = () => {
|
|||||||
if (ball) {
|
if (ball) {
|
||||||
var x = ball.style.left;
|
var x = ball.style.left;
|
||||||
var y = ball.style.top;
|
var y = ball.style.top;
|
||||||
var query = "http://localhost:5000/LRegresion" + x + "&" + y
|
var query = "http://localhost:5000/LRegresion" + shooterX + "&" + shooterY
|
||||||
|
|
||||||
fetch(query).then(
|
fetch(query).then(
|
||||||
|
res=> res.json()
|
||||||
|
).then(
|
||||||
data => {
|
data => {
|
||||||
setData(data)
|
setData(data)
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
alert(data.response)
|
||||||
} else {
|
} else {
|
||||||
alert('Piłka nie jest obecnie na boisku.');
|
alert('Piłka nie jest obecnie na boisku.');
|
||||||
}
|
}
|
||||||
@ -75,17 +80,23 @@ const Hero = () => {
|
|||||||
|
|
||||||
/* Funkcja dodająca listener do boiska*/
|
/* Funkcja dodająca listener do boiska*/
|
||||||
function boiskoListener(){
|
function boiskoListener(){
|
||||||
|
|
||||||
var x = event.clientX - footballField.getBoundingClientRect().left;
|
var x = event.clientX - footballField.getBoundingClientRect().left;
|
||||||
var y = event.clientY - footballField.getBoundingClientRect().top;
|
var y = event.clientY - footballField.getBoundingClientRect().top;
|
||||||
|
shooterX = (x * 105)/600
|
||||||
|
shooterY = ((400 - y) * 69)/ 400
|
||||||
|
|
||||||
// Przypadek kiedy zaznaczamy strzelca
|
// Przypadek kiedy zaznaczamy strzelca
|
||||||
if(active_bbt == "bbt1"){
|
if(active_bbt == "bbt1"){
|
||||||
var existingBall = document.querySelector('.football');
|
var existingBall = document.querySelector('.football');
|
||||||
|
|
||||||
if (!existingBall) {
|
if (!existingBall) {
|
||||||
var ball = document.createElement('div');
|
var ball = document.createElement('div');
|
||||||
ball.className = 'football';
|
ball.className = 'football';
|
||||||
ball.style.left = x + 'px';
|
ball.style.left = x + 'px';
|
||||||
ball.style.top = y + 'px';
|
ball.style.top = y + 'px';
|
||||||
footballField.appendChild(ball);
|
footballField.appendChild(ball);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert('Możesz dodać tylko jedną piłkę!');
|
alert('Możesz dodać tylko jedną piłkę!');
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -15,12 +15,12 @@ def members():
|
|||||||
|
|
||||||
@app.route("/LRegresion<x>&<y>")
|
@app.route("/LRegresion<x>&<y>")
|
||||||
def LRegresion(x,y):
|
def LRegresion(x,y):
|
||||||
|
|
||||||
x = int(x[0:2])
|
|
||||||
y = int(y[0:2])
|
|
||||||
|
|
||||||
response = LogisticRegression_predict_proba(9.23, -2.24, 9.5, 13.67, 13, 3, 0, 1, 0)
|
x = round(x,2)
|
||||||
return {"response":[str(response),"proces"]}
|
y = round(y,2)
|
||||||
|
|
||||||
|
response = LogisticRegression_predict_proba(x, y, 9.5, 13.67, 13, 3, 0, 1, 0)
|
||||||
|
return {"response":[str(response)]}
|
||||||
|
|
||||||
# uruchomienie serwera
|
# uruchomienie serwera
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user