Skip to content

Commit

Permalink
Fixed Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sarangparikh22 committed Oct 6, 2019
1 parent 6018ddb commit a2f2222
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
23 changes: 18 additions & 5 deletions dashboard/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ let shipLocationP2 = [];
let p1 = "0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1";
let p2 = "0xffcf8fdee72ac11b5c542428b35eef5769c409f0";

let sDp1 = 0;
let sDp2 = 0;

// let contractAddress = "0xe78a0f7e598cc8b0bb87894b0f60dd2a88d6a8ab";

Expand Down Expand Up @@ -331,7 +333,8 @@ function setShipPositionAndGetHashP1(s1,s2,s3){
document.getElementById('p1T').innerHTML = `<table cellspacing="500">${tableData}</table>`
console.log(JSON.stringify(shipHashLocationP1));
console.log('------------------------------');
console.log(shipLocationP1);
console.log(shipLocationP1);
document.getElementById('p1L').value = JSON.stringify(shipHashLocationP1);
let partyData = "";
for (let i = 0; i < 16; i++) {
let lI = i;
Expand Down Expand Up @@ -386,7 +389,9 @@ function setShipPositionAndGetHashP2(s1,s2,s3){
document.getElementById('p2T').innerHTML = `<table cellspacing="500">${tableData}</table>`
console.log(JSON.stringify(shipHashLocationP2));
console.log('------------------------------');
console.log(shipLocationP2);
console.log(shipLocationP2);
document.getElementById('p2L').value = JSON.stringify(shipHashLocationP2);

let partyData = "";
for (let i = 0; i < 16; i++) {
let lI = i;
Expand Down Expand Up @@ -414,7 +419,9 @@ function deploy(){
doCall(url, (cA) => {
setInterval(startTurnCheckP1, 500);
setInterval(startTurnCheckP2, 500);
console.log(cA);
console.log(cA);
payP1();
payP2();
});
// setInterval(startTurnCheckP1, 500);
}
Expand Down Expand Up @@ -503,9 +510,12 @@ function attackByP1(cell){
document.getElementById("p1"+loc).innerHTML = '<img src="lol.gif" height="100" width="100">';

}else{
sDp1 +=1;
document.getElementById("p2O"+loc).innerHTML = '<img src="win.gif" height="100" width="100">';
document.getElementById("p1"+loc).innerHTML = '<img src="win.gif" height="100" width="100">';

if(sDp1 > 2){
alert('Congratulations! You have won!')
}
}
})
})
Expand All @@ -527,9 +537,12 @@ function attackByP2(cell){
document.getElementById("p2"+loc).innerHTML = '<img src="lol.gif" height="100" width="100">';

}else{
sDp2 += 1;
document.getElementById("p1O"+loc).innerHTML = '<img src="win.gif" height="100" width="100">';
document.getElementById("p2"+loc).innerHTML = '<img src="win.gif" height="100" width="100">';

if(sDp2 > 2){
alert('Congratulations! You Won!');
}
}
})
})
Expand Down
4 changes: 2 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require('express');

const dep = require('./deployContract');
const bifrostWrapper = require("./bifrostWS");
// const bifrostWrapper = require("./bifrostWS");

const app = express();

Expand All @@ -11,7 +11,7 @@ app.all('/*', function(req, res, next) {
next();
});

app.use(express.static('chat'));
// app.use(express.static('chat'));

app.get('/saru',(req,res) => {
dep.deployContract(req.query.p1,req.query.p2,req.query.p1L,req.query.p2L, (tx) => {
Expand Down

0 comments on commit a2f2222

Please sign in to comment.