Removed studium

This commit is contained in:
2025-07-06 21:43:58 +02:00
parent 12b673de9f
commit 59db1227fe
7 changed files with 0 additions and 765 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,12 +0,0 @@
<svg id="ef-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<circle cx="500" cy="500" r="500" fill="#FFFFFF"/>
<g fill="#0080FF">
<rect x="430" y="240" width="50" height="520"/>
<rect x="190" y="240" width="265" height="50" />
<rect x="190" y="475" width="265" height="50" />
<rect x="190" y="710" width="265" height="50" />
<rect x="520" y="240" width="50" height="520"/>
<rect x="545" y="240" width="265" height="50" />
<rect x="545" y="475" width="265" height="50" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 570 B

View File

@@ -1,191 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1000"
height="100"
viewBox="0 0 264.58333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="symbols.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="true"
units="px"
gridtolerance="10"
inkscape:zoom="4.6726229"
inkscape:cx="918.43492"
inkscape:cy="46.440726"
inkscape:window-width="1920"
inkscape:window-height="1057"
inkscape:window-x="1016"
inkscape:window-y="1"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid824"
empspacing="100" />
</sodipodi:namedview>
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient17492">
<stop
style="stop-color:#fffaff;stop-opacity:1"
offset="0"
id="stop17488" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop17490" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient17492"
id="radialGradient17534"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.01185507,-0.00474077,0.00509163,0.01253756,245.5889,24.86303)"
cx="684.98218"
cy="-755.83978"
fx="684.98218"
fy="-755.83978"
r="399.74589" />
</defs>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="5.4673328"
y="23.171078"
id="text2764"><tspan
sodipodi:role="line"
id="tspan2762"
style="font-size:25.4px;stroke-width:0.264583"
x="5.4673328"
y="23.171078">1</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="31.925665"
y="23.171078"
id="text2764-6"><tspan
sodipodi:role="line"
id="tspan2762-7"
style="font-size:25.4px;stroke-width:0.264583"
x="31.925665"
y="23.171078">2</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="58.383999"
y="23.171078"
id="text2764-4"><tspan
sodipodi:role="line"
id="tspan2762-6"
style="font-size:25.4px;stroke-width:0.264583"
x="58.383999"
y="23.171078">3</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="84.581985"
y="23.171078"
id="text2764-67"><tspan
sodipodi:role="line"
id="tspan2762-3"
style="font-size:25.4px;stroke-width:0.264583"
x="84.581985"
y="23.171078">4</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="137.75899"
y="23.171078"
id="text2764-9"><tspan
sodipodi:role="line"
id="tspan2762-2"
style="font-size:25.4px;stroke-width:0.264583"
x="137.75899"
y="23.171078">6</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="112.24477"
y="23.171078"
id="text2764-5"><tspan
sodipodi:role="line"
id="tspan2762-0"
style="font-size:25.4px;stroke-width:0.264583"
x="112.24477"
y="23.171078">5</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="164.21733"
y="23.171078"
id="text2764-8"><tspan
sodipodi:role="line"
id="tspan2762-37"
style="font-size:25.4px;stroke-width:0.264583"
x="164.21733"
y="23.171078">7</tspan></text>
<text
xml:space="preserve"
style="font-weight:bold;font-size:25.4px;line-height:15.875px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="190.67566"
y="23.171078"
id="text2764-56"><tspan
sodipodi:role="line"
id="tspan2762-78"
style="font-size:25.4px;stroke-width:0.264583"
x="190.67566"
y="23.171078">8</tspan></text>
<rect
style="opacity:0.94;fill:#000000;fill-opacity:1;stroke-width:0.159074;stroke-linejoin:round"
id="rect13458"
width="3.0269053"
height="23.409332"
x="216.61328"
y="1.4898645" />
<path
sodipodi:type="star"
style="opacity:0.94;fill:#c80000;fill-opacity:1;stroke-width:1.88976;stroke-linejoin:round"
id="path13598"
inkscape:flatsided="true"
sodipodi:sides="3"
sodipodi:cx="830.13611"
sodipodi:cy="17.592884"
sodipodi:r1="31.913498"
sodipodi:r2="15.956749"
sodipodi:arg1="0"
sodipodi:arg2="1.0471976"
inkscape:rounded="0"
inkscape:randomized="0"
d="m 862.04961,17.592884 -47.87025,27.6379 v -55.2758 z"
transform="matrix(0.26458333,0,0,0.26458333,4.4504611,4.7744104)"
inkscape:transform-center-x="-2.1109449" />
<path
id="path15198"
style="opacity:0.94;fill:url(#radialGradient17534);fill-opacity:1;stroke:none;stroke-width:0.0611019;stroke-linejoin:round"
d="m 255.02903,18.922636 -2.38443,0.980073 -1.29044,6.689887 -1.29044,-6.689887 -2.38442,-0.980073 -2.81674,0.984166 0.99178,-2.795106 -0.98766,-2.366105 -6.74168,-1.280528 6.74168,-1.280527 0.98766,-2.3661053 -0.99178,-2.7951042 2.81674,0.9841643 2.38442,-0.9800724 1.29044,-6.6898862 1.29044,6.6898862 2.38443,0.9800733 2.81675,-0.9841652 -0.99178,2.7951042 0.98766,2.3661063 6.74167,1.280526 -6.74167,1.280528 -0.98766,2.366105 0.99178,2.795106 z"
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="author" content="Elias Fink">
<meta name="copyright" content="Copyright © 2024 Elias Fink">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<link rel="icon" href="images/favicon.ico">
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
<title>Minesweeper by Elias Fink</title>
</head>
<body>
</body>
</html>

View File

@@ -1,306 +0,0 @@
window.addEventListener('load', () => {
minesweeper.init();
});
const minesweeper = {
init() {
this.logic = remoteLogic;
this.generateBody();
this.newGame('small');
},
// ------------------------------------ //
// ----- Basic Body Structure ----- //
// ------------------------------------ //
generateBody() {
const body = document.body;
const container = document.createElement('div');
container.id = 'container';
body.appendChild(container);
container.append(this.getHeader(), this.getMain(), this.getButtons(), this.getFooter());
},
getHeader() {
const header = document.createElement('header');
const title = document.createElement('div');
title.id = 'title';
header.appendChild(title);
const heading = document.createElement('h1');
heading.innerText = 'Minesweeper';
const subheading = document.createElement('p');
subheading.innerText = 'by Elias Fink';
title.append(heading, subheading);
return header;
},
getMain() {
const main = document.createElement('main');
return main;
},
getButtons() {
const buttons = document.createElement('div');
buttons.id = 'buttons';
const smallButton = this.createButton('small');
const mediumButton = this.createButton('medium');
const largeButton = this.createButton('large');
buttons.append(smallButton, mediumButton, largeButton);
return buttons;
},
getFooter() {
const footer = document.createElement('footer');
const copyright = document.createElement('span');
copyright.innerHTML = 'Copyright &copy; 2024 Elias Fink';
const webLink = document.createElement('span');
webLink.innerHTML = '<a href="https://studium.eliasfink.de/it-lab/" target="_blank" rel="noopener noreferrer">Web Version</a>';
const gitLink = document.createElement('span');
gitLink.innerHTML = '<a href="https://github.com/eliasfnk/it-lab.git" target="_blank" rel="noopener noreferrer">Git Repository</a>';
footer.append(copyright, webLink, gitLink);
return footer;
},
// ---------------------------------- //
// ----- Buttons and Fields ----- //
// ---------------------------------- //
createButton(type) {
const button = document.createElement('button');
button.id = type;
button.innerText = type;
button.addEventListener('click', () => {
this.newGame(type);
});
return button;
},
generatePlayfield(size) {
const playfield = document.querySelector('main');
playfield.innerText = '';
for (let row = 0; row < size; row++) {
for (let col = 0; col < size; col++) {
playfield.appendChild(this.createCell(row, col));
}
}
},
createCell(row, col) {
const cell = document.createElement('div');
cell.classList.add('cell', 'covered');
cell.dataset.x = col;
cell.dataset.y = row;
cell.style.width = `calc(100% / ${this.size} - 2px)`;
cell.style.height = `calc(100% / ${this.size} - 2px)`;
this.cellEventListeners(cell);
return cell;
},
cellEventListeners(cell) {
cell.addEventListener('click', (event) => {
this.cellLeftClickHandler(event);
});
cell.addEventListener('contextmenu', (event) => {
this.cellRightClickHandler(event);
});
cell.addEventListener('touchstart', (event) => {
this.cellTouchStartHandler(event);
});
cell.addEventListener('touchend', (event) => {
this.cellTouchEndHandler(event);
});
},
// -------------------------- //
// ----- Game Start ----- //
// -------------------------- //
gameModes: [
{
name: 'small',
size: 9,
mines: 10
},
{
name: 'medium',
size: 16,
mines: 40
},
{
name: 'large',
size: 24,
mines: 150
},
],
async newGame(gameMode) {
for (const mode of this.gameModes) {
if (mode.name == gameMode) {
this.size = mode.size;
this.mines = mode.mines;
}
}
this.generatePlayfield(this.size);
await this.logic.init(this.size, this.mines);
},
// ------------------------------------ //
// ----- Click/Touch Handling ----- //
// ------------------------------------ //
async cellLeftClickHandler(event) {
event.preventDefault();
const x = event.target.dataset.x;
const y = event.target.dataset.y;
const result = await this.logic.sweep(x, y);
if (result.minehit) {
this.logic.gameLost(event, result.mines);
} else {
this.logic.uncoverCell(x, y, result.minesAround);
for (const cell of result.emptyCells) {
this.logic.uncoverCell(cell.x, cell.y, cell.minesAround);
}
if (result.userwins) {
this.logic.gameWon();
}
}
},
cellRightClickHandler(event) {
event.preventDefault();
event.target.classList.toggle('symbol-f');
},
cellTouchStartHandler(event) {
event.preventDefault();
this.touchStartTime = new Date().getTime();
},
cellTouchEndHandler(event) {
event.preventDefault();
const touchDuration = new Date().getTime() - this.touchStartTime;
if (touchDuration < 500) {
this.cellLeftClickHandler(event);
} else {
this.cellRightClickHandler(event);
}
}
};
// -------------------------------------------------- //
// -------------------------------------------------- //
// -------------------------------------------------- //
const remoteLogic = {
// ----------------------------- //
// ----- Field Filling ----- //
// ----------------------------- //
async init(size, mines) {
this.serverUrl = 'https://www2.hs-esslingen.de/~melcher/it/minesweeper/?';
const request = `request=init&size=${size}&mines=${mines}&userid=elfiit00`;
const response = await this.fetchAndDecode(request);
this.token = response.token;
},
async fetchAndDecode(request) {
return fetch(this.serverUrl + request).then(response => response.json());
},
// ------------------------------- //
// ----- Move Processing ----- //
// ------------------------------- //
async sweep(x, y) {
const request = `request=sweep&token=${this.token}&x=${x}&y=${y}`;
return this.fetchAndDecode(request);
},
// ------------------------------- //
// ----- Cell Uncovering ----- //
// ------------------------------- //
getCell(x, y) {
return document.querySelector(`[data-x="${x}"][data-y="${y}"]`);
},
uncoverCell(x, y, symbol) {
this.getCell(x, y).classList.remove('covered');
if (symbol) {
this.getCell(x, y).classList.add(`symbol-${symbol}`);
}
},
// ------------------------ //
// ----- Game End ----- //
// ------------------------ //
gameLost(event, mines) {
event.target.id = 'mine-hit';
for (const m of mines) {
this.uncoverCell(m.x, m.y, 'm');
}
this.displayOverlay('Game Over');
},
gameWon() {
this.displayOverlay('Victory');
},
displayOverlay(text) {
const overlay = document.createElement('div');
overlay.id = 'overlay';
const div = document.createElement('div');
div.innerText = text;
overlay.appendChild(div);
const main = document.querySelector('main');
main.appendChild(overlay);
}
};

View File

@@ -1,231 +0,0 @@
/* ------------------------- */
/* General */
/* ------------------------- */
:root {
--blue-1: #001A33;
--blue-2: #004D99;
--blue-3: #0080FF;
--blue-4: #66B3FF;
--blue-5: #CCE6FF;
--grey-1: #161A1D;
--grey-2: #434D56;
--grey-3: #708090;
--grey-4: #A9B3BC;
--grey-5: #E2E6E9;
--peach-fuzz: #ffbe98;
}
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
#container {
width: min(100vw, 55.555vh);
height: min(100vh, 180vw);
margin: 0 auto;
}
/* ------------------------ */
/* Header */
/* ------------------------ */
header {
height: calc(4 * 100% / 18);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
background-color: var(--blue-3);
color: #fff;
}
#title h1 {
font-size: 40px;
margin-bottom: 5px;
}
#title p {
font-size: 20px;
}
@media (min-width: 420px) {
header {
background-image: url(images/logo.svg);
background-size: 100px;
background-position: right 20px center;
background-repeat: no-repeat;
}
}
/* ------------------------------- */
/* Playing Field */
/* ------------------------------- */
main {
position: relative;
height: calc(10 * 100% / 18);
display: flex;
flex-wrap: wrap;
align-content: space-between;
justify-content: space-between;
border: 1px solid var(--grey-3);
}
.cell {
flex-shrink: 0;
background-color: var(--blue-5);
border: 1px solid var(--grey-3);
}
.covered {
background-color: var(--grey-4);
}
.symbol-1, .symbol-2, .symbol-3, .symbol-4, .symbol-5, .symbol-6, .symbol-7, .symbol-8, .symbol-f.covered, .symbol-m {
background-size: 1000%;
background-image: url(images/symbols.svg);
}
.symbol-1 {
background-position: calc(100% * 0 / 9);
}
.symbol-2 {
background-position: calc(100% * 1 / 9);
}
.symbol-3 {
background-position: calc(100% * 2 / 9);
}
.symbol-4 {
background-position: calc(100% * 3 / 9);
}
.symbol-5 {
background-position: calc(100% * 4 / 9);
}
.symbol-6 {
background-position: calc(100% * 5 / 9);
}
.symbol-7 {
background-position: calc(100% * 6 / 9);
}
.symbol-8 {
background-position: calc(100% * 7 / 9);
}
.symbol-f.covered {
background-position: calc(100% * 8 / 9);
}
.symbol-m {
background-position: calc(100% * 9 / 9);
}
#mine-hit {
background-color: var(--peach-fuzz);
}
#overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.4);
}
#overlay div {
padding: 16px 32px;
border-radius: 16px;
background-color: var(--blue-4);
font-size: 48px;
}
#overlay div:hover {
opacity: 0.2;
transition: 0.2s;
}
/* ------------------------- */
/* Buttons */
/* ------------------------- */
#buttons {
height: calc(3 * 100% / 18);
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 20px;
background-color: var(--grey-5);
}
button {
font-size: 16px;
text-transform: capitalize;
padding: 15px 30px;
margin: 0 2px;
color: #fff;
background-color: var(--blue-3);
border: 2px solid var(--blue-3);
cursor: pointer;
transition: 0.2s;
}
button:hover {
color: var(--blue-3);
background-color: transparent;
}
/* ------------------------ */
/* Footer */
/* ------------------------ */
footer {
height: calc(100% / 18);
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 20px;
background-color: var(--grey-2);
color: #fff;
}
footer a {
color: #fff;
text-decoration: none;
border-bottom: 1px solid #fff;
}
footer a:hover {
border-bottom: 0;
}
@media (max-width: 480px) {
footer span:not(:first-child) {
display: none;
}
}