-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
136 lines (122 loc) · 3.19 KB
/
Copy pathindex.html
File metadata and controls
136 lines (122 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CHESS</title>
<style>
:root {
--animation-speed: .1s;
}
body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100vh;
margin: 0;
background-color: #171717;
}
.board {
background-image: url(img/board.png);
width: 90vmin;
height: 90vmin;
background-size: 100%;
position: relative;
}
.status {
color: #fff;
font-family: sans-serif;
font-size: 3vmin;
height: 6vmin;
display: flex;
align-items: center;
justify-content: center;
}
.piece, .move {
position: absolute;
width: 12.5%;
height: 12.5%;
}
.piece {
background-size: 100%;
transition: top var(--animation-speed), left var(--animation-speed), transform .1s;
}
.piece.selected {
transform: scale(1.3);
filter: drop-shadow(2px 4px 6px rgba(0,0,0,.5));
}
.move {
background-color: rgba(50, 250, 50, 0.512);
transform: scale(.9);
}
.promote {
position: absolute;
background-color: rgba(0,0,0,.75);
width: 100%;
height: 100%;
z-index: 2;
color: #fff;
font-family: sans-serif;
font-size: 4vmin;
display: none;
align-items: center;
justify-content: center;
flex-direction: column;
}
.promote.show {
display: flex;
}
.promote .selector {
width: 50%;
height: 12.5%;
background: linear-gradient(-30deg, #728087, #DEE7E4);
position: relative;
display: flex;
border-radius: 1vmin;
box-shadow: 0 10px 20px rgba(0,0,0,.5);
padding: 4%;
margin-top: 4%;
}
.promote .selector > div {
width: 25%;
height: 100%;
background-size: 100%;
}
.promote .selector > div:hover {
background-color: rgba(0,0,0,.2);
border-radius: 0.5vmin;
}
.promote.white .q { background-image: url(img/wq.png); }
.promote.white .r { background-image: url(img/wr.png); }
.promote.white .b { background-image: url(img/wb.png); }
.promote.white .n { background-image: url(img/wn.png); }
.promote.black .q { background-image: url(img/bq.png); }
.promote.black .r { background-image: url(img/br.png); }
.promote.black .b { background-image: url(img/bb.png); }
.promote.black .n { background-image: url(img/bn.png); }
</style>
</head>
<body>
<div class="board">
<div class="promote">
Promote pawn
<div class="selector">
<div class="option q"></div>
<div class="option r"></div>
<div class="option b"></div>
<div class="option n"></div>
</div>
</div>
</div>
<div class="status"></div>
<script type="module">
import newGame from './game.js';
import random from './players/random.js';
import human from './players/human.js';
import offensive from './players/offensive.js';
newGame(offensive('w'), random('b'), 0);
</script>
</body>
</html>