This commit is contained in:
Alexander Munch-Hansen 2018-05-22 00:39:23 +02:00
parent f558bd0bcc
commit ae7bc87ed8
2 changed files with 3 additions and 5 deletions

View File

@ -16,8 +16,6 @@
<script src="typescript/func.js"></script> <script src="typescript/func.js"></script>
<div> <div>
<button id="tester" onclick="getRequest()">pls</button>
<button id="convert_to_board" onclick="convertToBoard()">converty</button>
<p id="roll" style="font-size: 20px"></p> <p id="roll" style="font-size: 20px"></p>
</div> </div>
<div id="pins"> <div id="pins">

View File

@ -1,4 +1,4 @@
const ip = "127.0.0.1"; const ip = "users.guava.space";
const port = "35270"; const port = "35270";
$(function () { $(function () {
const init_board = [0, 2, 0, 0, 0, 0, -5, 0, -3, 0, 0, 0, 5, -5, 0, 0, 0, 3, 0, 5, 0, 0, 0, 0, -2, 0]; const init_board = [0, 2, 0, 0, 0, 0, -5, 0, -3, 0, 0, 0, 5, -5, 0, 0, 0, 3, 0, 5, 0, 0, 0, 0, -2, 0];
@ -172,7 +172,7 @@ function getBotMove(board) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
async: false, async: false,
url: "http://" + ip + ":" + port + "/bot_move", url: ip + ":" + port + "/bot_move",
data: JSON.stringify(data), data: JSON.stringify(data),
success: function (data) { success: function (data) {
data.split(",").forEach(function (item, index) { data.split(",").forEach(function (item, index) {
@ -192,7 +192,7 @@ function postRequest(prevBoard, board, roll, totalRoll, quad) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
async: false, async: false,
url: "http://" + ip + ":" + port + "/post_board", url: ip + ":" + port + "/post_board",
data: JSON.stringify(data), data: JSON.stringify(data),
success: function (data) { success: function (data) {
let splitData = data.split("#"); let splitData = data.split("#");