const client = io()

client.on('connect', () => {
    console.log('connected')
})

client.on('welcome', () => {
    console.log('welcome')
})

const CARRIER = 1 // 航空母舰 5
const BATTLESHIP = 2 // 战列舰 4
const DESTROYER = 3 // 驱逐舰 3
const SUBMARINE = 4 // 潜艇 3
const PATROLBOAT = 5 // 巡逻艇 2

CONST.EMPTY = 0
CONST.SHIP = 1
CONST.MISS = 2
CONST.HIT = 3
CONST.SUNK = 4

function player_click(event) {
    const x = event.target.dataset.x
    const y = event.target.dataset.y
    const player = event.target.dataset.player
    const status = event.target.dataset.status
    console.log(x, y, player, status)
}

function enemy_click(event) {
    const x = event.target.dataset.x
    const y = event.target.dataset.y
    const player = event.target.dataset.player
    const status = event.target.dataset.status
    console.log(x, y, player, status)
}

function ship_rotate(event) {
    event.target.classList.toggle('ship-horizontal')
}
