Compare commits

...

5 Commits

Author SHA1 Message Date
VS-Code
66bd99b035 - 2026-02-06 15:16:39 +01:00
VS-Code
a3cc5b9463 fix index.html 2026-02-06 15:15:48 +01:00
VS-Code
d858d57752 fix | index.hmtl top-bar 2026-02-06 13:35:09 +01:00
VS-Code
c726b3e1e6 changed chess to chess_64 2026-02-06 13:23:45 +01:00
VS-Code
be15051395 fix | landingpage nav-bar 2026-02-06 13:17:51 +01:00
2 changed files with 68 additions and 143 deletions

View File

@@ -1,17 +1,21 @@
type_to_name = [] type_to_name = []
PIECE_TO_UNICODE = {"wk": "\u2654 ", "wq": "\u2655 ", "wr": "\u2656 ", "wb": "\u2657 ", "wn": "\u2658 ", "wp": "\u2659 ", PIECE_TO_UNICODE = {
"bk": "\u265A ", "bq": "\u265B ", "br": "\u265C ", "bb": "\u265D ", "bn": "\u265E ", "bp": "\u265F "} "wk": "\u2654 ", "wq": "\u2655 ", "wr": "\u2656 ", "wb": "\u2657 ", "wn": "\u2658 ", "wp": "\u2659 ",
"bk": "\u265A ", "bq": "\u265B ", "br": "\u265C ", "bb": "\u265D ", "bn": "\u265E ", "bp": "\u265F "
}
NOT_A_FILE = 0xfefefefefefefefe
NOT_H_FILE = 0x7f7f7f7f7f7f7f7f
INDEX_TO_FIELD = [ INDEX_TO_FIELD = [
"a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1", "a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1",
"a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2", "a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2",
"a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3", "a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3",
"a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4", "a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4",
"a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5", "a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5",
"a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6", "a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6",
"a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7", "a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7",
"a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8", "a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8",
] ]
''' Board Index: ''' Board Index:
@@ -27,125 +31,4 @@ INDEX_TO_FIELD = [
''' '''
class Piece():
def __init__(self, pce_type, is_white, index):
self.type = pce_type
self.is_white = is_white
self.has_castled = False if type == 'K' else True
self.index = index
self.bit_mask = 1 << index
class Move():
def __init__(self, start_index, end_index, piece_moved, piece_captured=None):
self.piece_moved = piece_moved
self.piece_captured = piece_captured
self.index_start = start_index
self.index_end = end_index
self.bitmask_start: int = 1 << start_index
self.bitmask_end = 1 << end_index
self.chess_notation = f"{self.piece_moved[1].upper()}{INDEX_TO_FIELD[self.index_start]}{INDEX_TO_FIELD[self.index_end]}"
class Board():
def __init__(self):
self.bit_mask_w = 0x0000000000000001FE7F800
self.bit_mask_b = 0x1FE7F800000000000000000
self.bit_mask_all=0x1FE7F80000000001FE7F800
self.white_to_move = True
# self.wr1 = Piece('R', True, 11)
# self.wn1 = Piece('N', True, 12)
# self.wb1 = Piece('B', True, 13)
# self.wk = Piece('K', True, 14)
# self.wq = Piece('Q', True, 15)
# self.wb2 = Piece('B', True, 16)
# self.wn2 = Piece('N', True, 17)
# self.wr2 = Piece('R', True, 18)
# self.wp = [Piece('P', True, 21),
# Piece('P', True, 22),
# Piece('P', True, 23),
# Piece('P', True, 24),
# Piece('P', True, 25),
# Piece('P', True, 26),
# Piece('P', True, 27),
# Piece('P', True, 28)]
self.piece_dict = {
'br1':81, 'bn1':82, 'bb1':83, 'bk' :84, 'bq' :85, 'bb2':86, 'bn2':87, 'br2':88,
'bp1':71, 'bp2':72, 'bp3':73, 'bp4':74, 'bp5':75, 'bp6':76, 'bp7':77, 'bp8':78,
'wp1':21, 'wp2':22, 'wp3':23, 'wp4':24, 'wp5':25, 'wp6':26, 'wp7':27, 'wp8':28,
'wr1':11, 'wn1':12, 'wb1':13, 'wk' :14, 'wq' :15, 'wb2':16, 'wn2':17, 'wr2':18,
}
self.move_log = []
def print_board(self):
for x in range(100):
if OUT_OF_BOARD & 1 << x != 0:
if (x+1) % 10 == 0:
print("")
continue
continue
if self.bit_mask_all & 1 << x != 0:
for p in self.piece_dict:
if self.piece_dict[p] == x:
print(f"{PIECE_TO_UNICODE[p[:2]]} ", end="")
else:
print("\u25FB ", end="")
def notation_to_move(self, notation_str): # Kb1a5
if len(notation_str) < 6:
start = INDEX_TO_FIELD.index(notation_str[1]+ notation_str[2])
end = INDEX_TO_FIELD.index(notation_str[3]+ notation_str[4])
for p in self.piece_dict:
if self.piece_dict[p] == start:
piece_moved = p
if self.piece_dict[p] == end:
piece_captured = p
if piece_moved and piece_captured:
return Move(start, end, piece_moved, piece_captured)
elif piece_moved:
return Move(start, end, piece_moved)
else:
print("No Piece to Move")
return
else:
print("Move to long")
return
def make_move(self, move):
self.piece_dict[move.piece_moved] = move.index_start
if self.white_to_move:
self.bit_mask_w = self.bit_mask_w & ~move.bitmask_start
self.bit_mask_w = self.bit_mask_w | move.bitmask_end
if move.piece_captured:
self.piece_dict[move.piece_captured] = -1
self.bit_mask_b = self.bit_mask_b & ~move.bitmask_end
else:
self.bit_mask_b = self.bit_mask_b & ~move.bitmask_start
self.bit_mask_b = self.bit_mask_b | move.bitmask_end
if move.piece_captured:
self.piece_dict[move.piece_captured] = -1
self.bit_mask_b = self.bit_mask_b & ~move.bitmask_end
self.bit_mask_all = self.bit_mask_w | self.bit_mask_b
self.move_log.append(move)
board = Board()
board.print_board()
while True:
print("Your Move, Please: ")
move_str = input()
if len(move_str) != 4:
print("Wrong Syntax")
continue
move = board.notation_to_move(move_str)
board.make_move(move)

View File

@@ -9,6 +9,10 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style> <style>
:root {
--text-color: #e0e0e0;
--accent-color: #1793d1;
}
/* Grundlayout */ /* Grundlayout */
body { body {
background-color: #1e1e1e; background-color: #1e1e1e;
@@ -29,19 +33,59 @@
} }
/* Navigation oben rechts */ /* Navigation oben rechts */
.nav-bar { .top-nav {
position: absolute; position: absolute;
top: 20px; top: 20px;
right: 20px; right: 20px;
display: flex;
gap: 15px;
} }
.nav-link { .nav-link {
color: #888; color: var(--text-color);
font-size: 24px; font-size: 1.5rem;
padding: 10px;
border-radius: 50%;
transition: all 0.3s ease;
position: relative;
display: flex; /* Zum Zentrieren des Icons */
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
background-color: rgba(255, 255, 255, 0.05);
text-decoration: none; text-decoration: none;
transition: color 0.3s;
} }
.nav-link:hover { color: #1793d1; }
.nav-link:hover {
background-color: var(--accent-color);
color: #fff;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(23, 147, 209, 0.4);
}
.nav-link::after {
content: attr(data-tooltip); /* Holt Text aus HTML attribute */
position: absolute;
bottom: -35px;
left: 50%;
transform: translateX(-50%);
background-color: #333;
color: #fff;
padding: 5px 10px;
border-radius: 4px;
font-size: 0.8rem;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s;
white-space: nowrap;
pointer-events: none;
}
.nav-link:hover::after {
opacity: 1;
visibility: visible;
}
/* Texte */ /* Texte */
h1 { font-size: 3rem; margin-bottom: 10px; color: #fff; letter-spacing: 2px; } h1 { font-size: 3rem; margin-bottom: 10px; color: #fff; letter-spacing: 2px; }
@@ -117,14 +161,14 @@
</head> </head>
<body> <body>
<div class="nav-bar" style="display: flex; gap: 20px;"> <div class="top-nav">
<a href="https://code.helios.giize.com" class="nav-link" data-tooltip="Code" target="_blank"> <a href="https://code.helios.giize.com" class="nav-link" data-tooltip="Code" target="_blank">
<i class="fa-solid fa-code"></i> <i class="fa-solid fa-code"></i>
</a> </a>
<a href="https://git.helios.giize.com" class="nav-link" data-tooptip="Gitea" target="_blank"> <a href="https://git.helios.giize.com" class="nav-link" data-tooltip="Gitea" target="_blank">
<i class="fa-brands fa-git-alt"></i> <i class="fa-brands fa-git-alt"></i>
</a> </a>
<a href="https://docker.helios.giize.com" class="nav-link" data-tooptip="Docker" target="_blank"> <a href="https://docker.helios.giize.com" class="nav-link" data-tooltip="Docker" target="_blank">
<i class="fa-brands fa-docker"></i> <i class="fa-brands fa-docker"></i>
</a> </a>
<a href="https://admin.helios.giize.com" class="nav-link" data-tooltip="Admin" target="_blank"> <a href="https://admin.helios.giize.com" class="nav-link" data-tooltip="Admin" target="_blank">
@@ -138,7 +182,7 @@
<p> <p>
Große Dinge haben kleine Anfänge. Diese Präsenz befindet sich derzeit im Aufbau. Große Dinge haben kleine Anfänge. Diese Präsenz befindet sich derzeit im Aufbau.
Schau später wieder vorbei, um Projekte rund um Entwicklung, Datenanalyse und mehr zu sehen. Schau später wieder vorbei, um Projekte rund um Spiele, Datenanalyse und mehr zu sehen.
</p> </p>
<div class="terminal"> <div class="terminal">
@@ -173,5 +217,3 @@
</body> </body>
</html> </html>