Merge branch 'master' of https://git.bib.de/PBT3H24AKH/LerningCSW
This commit is contained in:
172
MainPage/Abdelaziz/CrossWords.html
Normal file
172
MainPage/Abdelaziz/CrossWords.html
Normal file
@@ -0,0 +1,172 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Crossword Puzzle</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #000;
|
||||
margin-bottom: 20px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.grid-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.crossword-grid {
|
||||
display: inline-grid;
|
||||
gap: 0;
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
.cell {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid #000;
|
||||
background: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cell.blocked {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.cell input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.cell-number {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 2px;
|
||||
font-size: 8px;
|
||||
font-weight: normal;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.clues {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.clues-section h3 {
|
||||
font-size: 18px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 2px solid #000;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.clue {
|
||||
padding: 5px 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Crossword Puzzle - 21×21</h1>
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="crossword-grid" id="grid"></div>
|
||||
</div>
|
||||
|
||||
<div class="clues">
|
||||
<div class="clues-section">
|
||||
<h3>Across</h3>
|
||||
<div id="cluesAcross">
|
||||
</div>
|
||||
</div>
|
||||
<div class="clues-section">
|
||||
<h3>Down</h3>
|
||||
<div id="cluesDown">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const GRID_SIZE = 21;
|
||||
|
||||
function createGrid() {
|
||||
const grid = document.getElementById('grid');
|
||||
grid.style.gridTemplateColumns = `repeat(${GRID_SIZE}, 30px)`;
|
||||
|
||||
let clueNumber = 1;
|
||||
|
||||
for (let r = 0; r < GRID_SIZE; r++) {
|
||||
for (let c = 0; c < GRID_SIZE; c++) {
|
||||
const cell = document.createElement('div');
|
||||
cell.className = 'cell';
|
||||
|
||||
const isBlocked = (r + c) % 7 === 0 && r % 3 === 0;
|
||||
|
||||
if (isBlocked) {
|
||||
cell.classList.add('blocked');
|
||||
} else {
|
||||
const needsNumber = (c === 0 || (c > 0 && isBlackSquare(r, c-1))) ||
|
||||
(r === 0 || (r > 0 && isBlackSquare(r-1, c)));
|
||||
|
||||
if (needsNumber && (c < GRID_SIZE-1 || r < GRID_SIZE-1)) {
|
||||
const num = document.createElement('span');
|
||||
num.className = 'cell-number';
|
||||
num.textContent = clueNumber++;
|
||||
cell.appendChild(num);
|
||||
}
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.maxLength = 1;
|
||||
cell.appendChild(input);
|
||||
}
|
||||
|
||||
grid.appendChild(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isBlackSquare(r, c) {
|
||||
return (r + c) % 7 === 0 && r % 3 === 0;
|
||||
}
|
||||
|
||||
createGrid();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
39
MainPage/MainPage.html
Normal file
39
MainPage/MainPage.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Game Platform</title>
|
||||
<link rel="stylesheet" href="MainPageStyle.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Team Game Platform</h1>
|
||||
|
||||
<div class="games-container">
|
||||
<div class="game-card" onclick="location.href='member1/game.html'">
|
||||
<h2>Game 1</h2>
|
||||
<p>Member 1</p>
|
||||
</div>
|
||||
|
||||
<div class="game-card" onclick="location.href='younes/Streichholzreatsel.html'">
|
||||
<h2>Game 2</h2>
|
||||
<p>Streichholzrätsel</p>
|
||||
</div>
|
||||
|
||||
<div class="game-card" onclick="location.href='stas/WoerterLernen.html'">
|
||||
<h2>Game 3</h2>
|
||||
<p>Wörter lernen</p>
|
||||
</div>
|
||||
|
||||
<div class="game-card" onclick="location.href='Abdelaziz/CrossWords.html'">
|
||||
<h2>CrossWord</h2>
|
||||
<p>Abdelaziz</p>
|
||||
</div>
|
||||
|
||||
<div class="game-card" onclick="location.href='member5/game.html'">
|
||||
<h2>Game 5</h2>
|
||||
<p>Member 5</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
34
MainPage/MainPageStyle.css
Normal file
34
MainPage/MainPageStyle.css
Normal file
@@ -0,0 +1,34 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 900px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.games-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 20px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.game-card {
|
||||
border: 1px solid #ccc;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.game-card h2 {
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.game-card p {
|
||||
margin: 0;
|
||||
color: #666;
|
||||
}
|
||||
53
MainPage/stas/WoerterLernen.html
Normal file
53
MainPage/stas/WoerterLernen.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Meine Website</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="main-header">
|
||||
<h1>Flashcards Generator</h1>
|
||||
</header>
|
||||
<div class="main-wrapper">
|
||||
<div class="section-title">
|
||||
<div class="content">
|
||||
<label for="inputText" class="inputText">Sende deine Wortliste an ChatGPT mit folgender Anweisung:</label>
|
||||
</div>
|
||||
<div id="aufgabe_fuer_gpt">
|
||||
<pre id="formatText">
|
||||
Bitte formatiere meine Wortliste exakt nach folgendem Schema.
|
||||
Jeder Eintrag muss durch eine Leerzeile getrennt sein.
|
||||
|
||||
Englisches Wort
|
||||
[IPA-Transkription]
|
||||
Beispielsatz auf Englisch
|
||||
Deutsche Übersetzung des Wortes
|
||||
Beispielsatz auf Deutsch
|
||||
</pre>
|
||||
<button id="copyButton" style="position: absolute; top: 5px; right: 5px; cursor: pointer;">📋</button>
|
||||
</div>
|
||||
<div class="content">
|
||||
<label for="inputText" class="section-title">Füge deinen Text hier ein</label>
|
||||
<textarea id="inputText" placeholder="Hier Text einfügen..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<button id="kartenErstellen">Karten erstellen</button>
|
||||
|
||||
<div id="kartenContainer"></div>
|
||||
|
||||
<div id="flashcards-container"></div>
|
||||
<script src="js/eigenerCode.js"></script>
|
||||
</div>
|
||||
<<<<<<< HEAD:WoerterLernen.html
|
||||
=======
|
||||
<textarea id="inputText" rows="10" cols="50" placeholder="Hier Text einfügen..."></textarea>
|
||||
<div id="kartenContainer"></div>
|
||||
<button id="kartenErstellen">Karten erstellen</button>
|
||||
|
||||
<div id="flashcards-container"></div>
|
||||
<script src="eigenerCode.js"></script>
|
||||
>>>>>>> a18b892e86a6b427b23c2eb100b9986d3c15121c:MainPage/stas/WoerterLernen.html
|
||||
</body>
|
||||
</html>
|
||||
112
MainPage/stas/eigenerCode.js
Normal file
112
MainPage/stas/eigenerCode.js
Normal file
@@ -0,0 +1,112 @@
|
||||
let parsedArray = [];
|
||||
|
||||
document.getElementById('copyButton').addEventListener('click', () => {
|
||||
const text = document.getElementById('formatText').innerText;
|
||||
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
alert('Format wurde in die Zwischenablage kopiert!');
|
||||
}).catch(err => {
|
||||
console.error('Konnte nicht kopieren: ', err);
|
||||
});
|
||||
|
||||
for (let i = 0; i < parsedArray.length; i += 8) {
|
||||
const pageFront = document.createElement("div");
|
||||
pageFront.className = "page_front";
|
||||
const pageBack = document.createElement("div");
|
||||
pageBack.className = "page_back";
|
||||
|
||||
const currentSlice = parsedArray.slice(i, i + 8);
|
||||
currentSlice.forEach(karte => {
|
||||
const frontCard = document.createElement("div");
|
||||
frontCard.className = "card";
|
||||
frontCard.innerHTML = `<h2>${karte.englisch}</h2><div>${karte.ipa}</div><p>${karte.beispielEN}</p>`;
|
||||
pageFront.appendChild(frontCard);
|
||||
|
||||
const backCard = document.createElement("div");
|
||||
backCard.className = "card";
|
||||
backCard.innerHTML = `<h2>${karte.deutsch}</h2><p>${karte.beispielDE}</p>`;
|
||||
pageBack.appendChild(backCard);
|
||||
});
|
||||
|
||||
container.appendChild(pageFront);
|
||||
container.appendChild(pageBack);
|
||||
}
|
||||
});
|
||||
|
||||
function parseWordText(inputText) {
|
||||
const wortBlocks = inputText.trim().split("\n\n");
|
||||
const wortListe = [];
|
||||
|
||||
for (let block of wortBlocks) {
|
||||
const lines = block.trim().split("\n").map(line => line.trim());
|
||||
|
||||
if (lines.length !== 5) {
|
||||
console.warn("Block übersprungen (falsches Format):", block);
|
||||
continue;
|
||||
}
|
||||
|
||||
const wortObj = {
|
||||
englisch: lines[0],
|
||||
ipa: lines[1],
|
||||
beispielEN: lines[2],
|
||||
deutsch: lines[3],
|
||||
beispielDE: lines[4]
|
||||
};
|
||||
|
||||
wortListe.push(wortObj);
|
||||
}
|
||||
|
||||
return wortListe;
|
||||
}
|
||||
|
||||
function createPagePair() {
|
||||
const frontPage = document.createElement("div");
|
||||
frontPage.className = "page page-front";
|
||||
|
||||
const backPage = document.createElement("div");
|
||||
backPage.className = "page page-back";
|
||||
|
||||
return { frontPage, backPage };
|
||||
}
|
||||
|
||||
const button = document.getElementById("kartenErstellen");
|
||||
const onlineContainer = document.getElementById("kartenContainer");
|
||||
const frontPage = document.querySelector(".page_front");
|
||||
const backPage = document.querySelector(".page_back");
|
||||
|
||||
button.addEventListener("click", () => {
|
||||
const inputText = document.getElementById("inputText").value;
|
||||
parsedArray = parseWordText(inputText);
|
||||
|
||||
kartenContainer.innerHTML = "";
|
||||
kartenContainer.style.display = "flex";
|
||||
kartenContainer.style.flexDirection = "column";
|
||||
|
||||
for (let i = 0; i < parsedArray.length; i += 8) {
|
||||
|
||||
const { frontPage, backPage } = createPagePair();
|
||||
|
||||
parsedArray.slice(i, i + 8).forEach((karte) => {
|
||||
|
||||
const frontCard = document.createElement("div");
|
||||
frontCard.className = "card card-en";
|
||||
frontCard.innerHTML = `
|
||||
<h2>${karte.englisch}</h2>
|
||||
<div class="ipa">${karte.ipa}</div>
|
||||
<div class="example">${karte.beispielEN}</div>
|
||||
`;
|
||||
frontPage.appendChild(frontCard);
|
||||
|
||||
const backCard = document.createElement("div");
|
||||
backCard.className = "card card-de";
|
||||
backCard.innerHTML = `
|
||||
<h2>${karte.deutsch}</h2>
|
||||
<div class="example">${karte.beispielDE}</div>
|
||||
`;
|
||||
backPage.appendChild(backCard);
|
||||
});
|
||||
|
||||
kartenContainer.appendChild(frontPage);
|
||||
kartenContainer.appendChild(backPage);
|
||||
}
|
||||
});
|
||||
192
MainPage/stas/style.css
Normal file
192
MainPage/stas/style.css
Normal file
@@ -0,0 +1,192 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Arial", sans-serif;
|
||||
background-color: #f4f6fb;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.main-header {
|
||||
position: relative;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
background-color: #005b5b;
|
||||
color: white;
|
||||
padding: 18px 0;
|
||||
text-align: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.main-header h1 {
|
||||
margin: 0;
|
||||
font-size: 46px;
|
||||
font-weight: 600;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
margin-top: 10px;
|
||||
padding: 20px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.input-section {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.input-section h2 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.hint-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#aufgabe_fuer_gpt {
|
||||
position: relative;
|
||||
background-color: #f0f3ff;
|
||||
border: 1px dashed #9aa5ff;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
margin: 20px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#aufgabe_fuer_gpt pre {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
#copyButton {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
background: white;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#inputText {
|
||||
width: 100%;
|
||||
min-height: 220px;
|
||||
padding: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #ccc;
|
||||
resize: vertical;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#kartenContainer {
|
||||
margin-top: 30px;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
gap: 40px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 210mm;
|
||||
height: 297mm;
|
||||
/* border: px solid #005b5b; */
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.page-back {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-template-rows: repeat(4, 1fr);
|
||||
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.page-back .card {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border: 1px dashed #333;
|
||||
border-radius: 0;
|
||||
padding: 25px;
|
||||
box-sizing: border-box;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.card::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 10mm;
|
||||
}
|
||||
|
||||
.card-en::before {
|
||||
background-color: #f4c430;
|
||||
}
|
||||
|
||||
.card-de::before {
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
margin: 0;
|
||||
margin-bottom: 6px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.card .ipa {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
/* margin-bottom: 80px; */
|
||||
}
|
||||
|
||||
.card .example {
|
||||
margin-top: 80px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
266
MainPage/younes/Streichholzreatsel.css
Normal file
266
MainPage/younes/Streichholzreatsel.css
Normal file
@@ -0,0 +1,266 @@
|
||||
:root{
|
||||
--bg:#0b1020;
|
||||
--panel:#0f1733;
|
||||
--text:#e9eeff;
|
||||
--muted:#9fb0ff;
|
||||
--shadow: 0 10px 30px rgba(0,0,0,.35);
|
||||
--gap: 14px;
|
||||
--matchW: 14px;
|
||||
--matchL: 68px;
|
||||
--matchT: 14px;
|
||||
--radius: 12px;
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
body{
|
||||
margin:0;
|
||||
min-height:100vh;
|
||||
background: radial-gradient(1200px 600px at 20% 20%, #1a2a7a 0%, transparent 60%),
|
||||
radial-gradient(900px 500px at 85% 30%, #2b1a7a 0%, transparent 60%),
|
||||
var(--bg);
|
||||
color:var(--text);
|
||||
font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
padding:24px;
|
||||
}
|
||||
.app{
|
||||
width:min(1100px, 100%);
|
||||
display:grid;
|
||||
grid-template-columns: 1.3fr .9fr;
|
||||
gap:18px;
|
||||
}
|
||||
@media (max-width: 980px){
|
||||
.app{grid-template-columns:1fr}
|
||||
}
|
||||
|
||||
.card{
|
||||
background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
|
||||
border: 1px solid rgba(255,255,255,.10);
|
||||
border-radius: 18px;
|
||||
box-shadow: var(--shadow);
|
||||
overflow:hidden;
|
||||
}
|
||||
.card-header{
|
||||
padding:16px 18px;
|
||||
border-bottom: 1px solid rgba(255,255,255,.10);
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
gap:12px;
|
||||
}
|
||||
.title{
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap:4px;
|
||||
}
|
||||
.title h1{
|
||||
font-size:18px;
|
||||
margin:0;
|
||||
letter-spacing:.2px;
|
||||
}
|
||||
.title .sub{
|
||||
font-size:12px;
|
||||
color:var(--muted);
|
||||
}
|
||||
.controls{
|
||||
display:flex;
|
||||
gap:10px;
|
||||
flex-wrap:wrap;
|
||||
justify-content:flex-end;
|
||||
}
|
||||
button{
|
||||
border:none;
|
||||
padding:10px 12px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255,255,255,.12);
|
||||
color:var(--text);
|
||||
cursor:pointer;
|
||||
font-weight:600;
|
||||
letter-spacing:.2px;
|
||||
transition: transform .05s ease, background .2s ease;
|
||||
user-select:none;
|
||||
}
|
||||
button:hover{ background: rgba(255,255,255,.18); }
|
||||
button:active{ transform: translateY(1px); }
|
||||
button.primary{
|
||||
background: linear-gradient(180deg, rgba(102,168,255,.7), rgba(102,168,255,.35));
|
||||
}
|
||||
button.primary:hover{
|
||||
background: linear-gradient(180deg, rgba(102,168,255,.85), rgba(102,168,255,.45));
|
||||
}
|
||||
|
||||
.play{
|
||||
padding:18px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap:14px;
|
||||
}
|
||||
|
||||
.statusRow{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap:10px;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
background: rgba(0,0,0,.18);
|
||||
border: 1px solid rgba(255,255,255,.08);
|
||||
border-radius: 14px;
|
||||
padding:12px 14px;
|
||||
}
|
||||
.pill{
|
||||
display:inline-flex;
|
||||
align-items:center;
|
||||
gap:8px;
|
||||
padding:8px 10px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255,255,255,.08);
|
||||
font-size:12px;
|
||||
color:var(--text);
|
||||
border:1px solid rgba(255,255,255,.08);
|
||||
white-space:nowrap;
|
||||
}
|
||||
.dot{
|
||||
width:10px;height:10px;border-radius:50%;
|
||||
background:#ff5c5c;
|
||||
box-shadow: 0 0 0 3px rgba(255,92,92,.15);
|
||||
}
|
||||
.dot.ok{
|
||||
background:#29e07a;
|
||||
box-shadow: 0 0 0 3px rgba(41,224,122,.15);
|
||||
}
|
||||
|
||||
/* Equation layout */
|
||||
.equationWrap{
|
||||
background: rgba(0,0,0,.18);
|
||||
border: 1px solid rgba(255,255,255,.08);
|
||||
border-radius: 16px;
|
||||
padding:16px;
|
||||
overflow:auto;
|
||||
}
|
||||
.equation{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
gap: var(--gap);
|
||||
padding:8px;
|
||||
min-width: 740px;
|
||||
}
|
||||
.group{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
gap: var(--gap);
|
||||
}
|
||||
.symbol{
|
||||
font-size: 34px;
|
||||
font-weight: 900;
|
||||
color: rgba(255,255,255,.85);
|
||||
padding: 6px 10px;
|
||||
border-radius: 14px;
|
||||
background: rgba(255,255,255,.06);
|
||||
border: 1px solid rgba(255,255,255,.08);
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
.digit{
|
||||
position:relative;
|
||||
width: 110px;
|
||||
height: 170px;
|
||||
border-radius: 16px;
|
||||
background: rgba(255,255,255,.04);
|
||||
border: 1px solid rgba(255,255,255,.07);
|
||||
box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
|
||||
flex:0 0 auto;
|
||||
}
|
||||
|
||||
.seg{
|
||||
position:absolute;
|
||||
width: var(--matchL);
|
||||
height: var(--matchW);
|
||||
border-radius: 999px;
|
||||
cursor:pointer;
|
||||
transition: filter .12s ease, transform .05s ease;
|
||||
box-shadow: 0 10px 18px rgba(0,0,0,.25);
|
||||
}
|
||||
.seg:hover{ filter: brightness(1.1); }
|
||||
.seg:active{ transform: translateY(1px); }
|
||||
|
||||
.seg.removed{
|
||||
background: rgba(255,255,255,0) !important;
|
||||
box-shadow:none;
|
||||
cursor:not-allowed;
|
||||
pointer-events:none;
|
||||
}
|
||||
|
||||
|
||||
.seg.a{ top: 16px; left: 21px; }
|
||||
.seg.b{ top: 32px; left: 73px; width: var(--matchW); height: var(--matchL); }
|
||||
.seg.c{ top: 92px; left: 73px; width: var(--matchW); height: var(--matchL); }
|
||||
.seg.d{ top: 146px; left: 21px; }
|
||||
.seg.e{ top: 92px; left: 23px; width: var(--matchW); height: var(--matchL); }
|
||||
.seg.f{ top: 32px; left: 23px; width: var(--matchW); height: var(--matchL); }
|
||||
.seg.g{ top: 81px; left: 21px; }
|
||||
|
||||
.side{
|
||||
padding:18px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap:14px;
|
||||
}
|
||||
.hint{
|
||||
background: rgba(0,0,0,.18);
|
||||
border: 1px solid rgba(255,255,255,.08);
|
||||
border-radius: 16px;
|
||||
padding:14px;
|
||||
color: rgba(255,255,255,.9);
|
||||
font-size:13px;
|
||||
line-height:1.4;
|
||||
}
|
||||
.hint b{ color:#fff; }
|
||||
|
||||
.removedBox{
|
||||
background: rgba(0,0,0,.18);
|
||||
border: 1px solid rgba(255,255,255,.08);
|
||||
border-radius: 16px;
|
||||
padding:14px;
|
||||
min-height: 160px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap:10px;
|
||||
}
|
||||
.removedHeader{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
gap:10px;
|
||||
}
|
||||
.removedHeader .label{
|
||||
font-weight:800;
|
||||
font-size:13px;
|
||||
color: rgba(255,255,255,.92);
|
||||
}
|
||||
.removedHeader .count{
|
||||
font-size:12px;
|
||||
color: var(--muted);
|
||||
white-space:nowrap;
|
||||
}
|
||||
.removedGrid{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap:10px;
|
||||
align-items:center;
|
||||
}
|
||||
.removedSeg{
|
||||
width: 44px;
|
||||
height: 16px;
|
||||
border-radius: 999px;
|
||||
box-shadow: 0 8px 16px rgba(0,0,0,.25);
|
||||
border: 1px solid rgba(255,255,255,.12);
|
||||
}
|
||||
.footerNote{
|
||||
font-size:12px;
|
||||
color: rgba(255,255,255,.7);
|
||||
line-height:1.35;
|
||||
}
|
||||
.mono{
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
|
||||
}
|
||||
76
MainPage/younes/Streichholzreatsel.html
Normal file
76
MainPage/younes/Streichholzreatsel.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<link rel="stylesheet" href="Streichholzreatsel.css" />
|
||||
<title>Allumettes (Matchstick) Equation Infinite Levels</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="title">
|
||||
<h1>Allumettes Equation Infinite Levels</h1>
|
||||
<div class="sub">Klicke auf die Streichhölzer, um sie zu entfernen (sie werden weiß bzw. unsichtbar).
|
||||
Mache die Gleichung wahr, indem du genau die vorgegebene Anzahl entfernst.</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button id="btnReset">Reset level</button>
|
||||
<button id="btnNew" class="primary">Neu level</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="play">
|
||||
<div class="statusRow">
|
||||
<div class="pill"><span class="mono">Level:</span> <span id="lvl">1</span></div>
|
||||
<div class="pill"><span class="mono">lösch target:</span> <span id="target">2</span></div>
|
||||
<div class="pill"><span class="mono">gelöscht</span> <span id="removedCount">0</span></div>
|
||||
<div class="pill">
|
||||
<span class="dot" id="truthDot"></span>
|
||||
<span class="mono" id="truthText">Equation ist falsch</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="equationWrap">
|
||||
<div class="equation" id="equation"></div>
|
||||
</div>
|
||||
|
||||
<div class="footerNote">
|
||||
Goal: lösch <b id="goalN">N</b> sodass die Gleichung <b>WAHR</b> wird.
|
||||
Es ist nur das Entfernen erlaubt (kein Hinzufügen). Die Ziffern bestehen aus 7 Segmenten.
|
||||
Der Generator garantiert, dass jedes Level lösbar ist (unendlich viele Level).
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="title">
|
||||
<h1>gelöschte matches</h1>
|
||||
<div class="sub">jede click clont den match hier.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="side">
|
||||
<div class="hint" id="hint"></div>
|
||||
|
||||
<div class="removedBox">
|
||||
<div class="removedHeader">
|
||||
<div class="label">gelöschte pile</div>
|
||||
<div class="count"><span id="pileCount">0</span> sticks</div>
|
||||
</div>
|
||||
<div class="removedGrid" id="removedGrid"></div>
|
||||
</div>
|
||||
|
||||
<div class="hint">
|
||||
<b>Tip:</b> Du kannst Streichhölzer von jeder Ziffer in der Gleichung entfernen.
|
||||
Eine Ziffer ändert sich nur dann in eine andere Ziffer, wenn die verbleibenden Segmente einem gültigen Muster von 0 bis 9 entsprechen.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="Streichholzreatsel.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
299
MainPage/younes/Streichholzreatsel.js
Normal file
299
MainPage/younes/Streichholzreatsel.js
Normal file
@@ -0,0 +1,299 @@
|
||||
|
||||
|
||||
|
||||
const SEG = { a:0, b:1, c:2, d:3, e:4, f:5, g:6 };
|
||||
const segNames = ["a","b","c","d","e","f","g"];
|
||||
|
||||
function maskFromSegments(list){
|
||||
let m = 0;
|
||||
for(const s of list) m |= (1 << SEG[s]);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
const DIGIT_MASK = [
|
||||
maskFromSegments(["a","b","c","d","e","f"]),
|
||||
maskFromSegments(["b","c"]),
|
||||
maskFromSegments(["a","b","d","e","g"]),
|
||||
maskFromSegments(["a","b","c","d","g"]),
|
||||
maskFromSegments(["b","c","f","g"]),
|
||||
maskFromSegments(["a","c","d","f","g"]),
|
||||
maskFromSegments(["a","c","d","e","f","g"]),
|
||||
maskFromSegments(["a","b","c"]),
|
||||
maskFromSegments(["a","b","c","d","e","f","g"]),
|
||||
maskFromSegments(["a","b","c","d","f","g"])
|
||||
];
|
||||
|
||||
|
||||
const MASK_TO_DIGIT = new Map(DIGIT_MASK.map((m,d)=>[m,d]));
|
||||
|
||||
|
||||
function removableTargetsFromDigit(d){
|
||||
const start = DIGIT_MASK[d];
|
||||
const res = [];
|
||||
for(let t=0;t<=9;t++){
|
||||
const target = DIGIT_MASK[t];
|
||||
if((target & start) === target){
|
||||
|
||||
const removed = popcount(start ^ target);
|
||||
res.push({to:t, removed});
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function popcount(x){
|
||||
x = x >>> 0;
|
||||
let c = 0;
|
||||
while(x){ x &= (x-1); c++; }
|
||||
return c;
|
||||
}
|
||||
|
||||
function randInt(min, max){ // inclusive
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
function pick(arr){ return arr[randInt(0, arr.length-1)]; }
|
||||
|
||||
let level = 1;
|
||||
let targetRemove = 2;
|
||||
let current = null;
|
||||
let solution = null;
|
||||
let removedSoFar = 0;
|
||||
|
||||
|
||||
let removedSet = new Set();
|
||||
|
||||
const elEq = document.getElementById("equation");
|
||||
const elRemovedGrid = document.getElementById("removedGrid");
|
||||
const elRemovedCount = document.getElementById("removedCount");
|
||||
const elPileCount = document.getElementById("pileCount");
|
||||
const elLvl = document.getElementById("lvl");
|
||||
const elTarget = document.getElementById("target");
|
||||
const elGoalN = document.getElementById("goalN");
|
||||
const elTruthDot = document.getElementById("truthDot");
|
||||
const elTruthText = document.getElementById("truthText");
|
||||
const elHint = document.getElementById("hint");
|
||||
|
||||
document.getElementById("btnNew").addEventListener("click", () => {
|
||||
level++;
|
||||
generateLevel();
|
||||
});
|
||||
document.getElementById("btnReset").addEventListener("click", () => {
|
||||
|
||||
resetPlayState();
|
||||
renderEquation();
|
||||
updateTruthUI();
|
||||
});
|
||||
|
||||
function segmentsFromMask(mask){
|
||||
const set = new Set();
|
||||
for(let i=0;i<7;i++){
|
||||
if(mask & (1<<i)) set.add(segNames[i]);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
function displayedMaskForDigit(digitValue, digitIndex){
|
||||
let mask = DIGIT_MASK[digitValue];
|
||||
for(const s of segNames){
|
||||
const key = digitIndex + "-" + s;
|
||||
if(removedSet.has(key)){
|
||||
mask &= ~(1 << SEG[s]);
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
function displayedDigitValue(digitValue, digitIndex){
|
||||
const mask = displayedMaskForDigit(digitValue, digitIndex);
|
||||
return MASK_TO_DIGIT.has(mask) ? MASK_TO_DIGIT.get(mask) : null;
|
||||
}
|
||||
|
||||
function equationIsTrue(){
|
||||
|
||||
const a = displayedDigitValue(current.A, 0);
|
||||
const b = displayedDigitValue(current.B, 1);
|
||||
const c = displayedDigitValue(current.C, 2);
|
||||
if(a === null || b === null || c === null) return false;
|
||||
return (a + b) === c;
|
||||
}
|
||||
|
||||
function updateTruthUI(){
|
||||
const ok = equationIsTrue();
|
||||
elTruthDot.classList.toggle("ok", ok);
|
||||
elTruthText.textContent = ok ? "Equation is TRUE" : "Equation is FALSE";
|
||||
}
|
||||
|
||||
|
||||
function resetPlayState(){
|
||||
removedSet.clear();
|
||||
removedSoFar = 0;
|
||||
elRemovedGrid.innerHTML = "";
|
||||
syncRemovedCounts();
|
||||
}
|
||||
|
||||
function syncRemovedCounts(){
|
||||
elRemovedCount.textContent = String(removedSoFar);
|
||||
elPileCount.textContent = String(removedSoFar);
|
||||
}
|
||||
|
||||
function renderDigit(digitValue, digitIndex, color){
|
||||
const digit = document.createElement("div");
|
||||
digit.className = "digit";
|
||||
|
||||
const baseMask = DIGIT_MASK[digitValue];
|
||||
const baseSegs = segmentsFromMask(baseMask);
|
||||
|
||||
for(const s of segNames){
|
||||
if(!baseSegs.has(s)) continue;
|
||||
|
||||
const seg = document.createElement("div");
|
||||
seg.className = "seg " + s;
|
||||
seg.style.background = color;
|
||||
|
||||
const key = digitIndex + "-" + s;
|
||||
if(removedSet.has(key)) seg.classList.add("removed");
|
||||
|
||||
seg.addEventListener("click", () => {
|
||||
if(removedSet.has(key)) return;
|
||||
if(removedSoFar >= targetRemove) return;
|
||||
|
||||
removedSet.add(key);
|
||||
removedSoFar++;
|
||||
|
||||
|
||||
seg.classList.add("removed");
|
||||
|
||||
|
||||
const clone = document.createElement("div");
|
||||
clone.className = "removedSeg";
|
||||
clone.style.background = color;
|
||||
elRemovedGrid.appendChild(clone);
|
||||
|
||||
syncRemovedCounts();
|
||||
updateTruthUI();
|
||||
|
||||
if(removedSoFar === targetRemove){
|
||||
if(equationIsTrue()){
|
||||
elHint.innerHTML = "<b>Solved!</b> You removed exactly the target and made the equation true. Click <b>New level</b>.";
|
||||
} else {
|
||||
elHint.innerHTML = " <b>Not solved.</b> You used all removals but the equation isn’t true. Click <b>Reset level</b> to try again.";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
digit.appendChild(seg);
|
||||
}
|
||||
return digit;
|
||||
}
|
||||
|
||||
function renderEquation(){
|
||||
elEq.innerHTML = "";
|
||||
|
||||
const colors = [
|
||||
"linear-gradient(180deg,#ff6b6b,#d64545)",
|
||||
"linear-gradient(180deg,#6bcBff,#3a7bd5)",
|
||||
"linear-gradient(180deg,#6bffb3,#1fae63)"
|
||||
];
|
||||
|
||||
const g1 = document.createElement("div");
|
||||
g1.className = "group";
|
||||
g1.appendChild(renderDigit(current.A, 0, colors[0]));
|
||||
|
||||
const plus = document.createElement("div");
|
||||
plus.className = "symbol";
|
||||
plus.textContent = "+";
|
||||
|
||||
const g2 = document.createElement("div");
|
||||
g2.className = "group";
|
||||
g2.appendChild(renderDigit(current.B, 1, colors[1]));
|
||||
|
||||
const eq = document.createElement("div");
|
||||
eq.className = "symbol";
|
||||
eq.textContent = "=";
|
||||
|
||||
const g3 = document.createElement("div");
|
||||
g3.className = "group";
|
||||
g3.appendChild(renderDigit(current.C, 2, colors[2]));
|
||||
|
||||
elEq.appendChild(g1);
|
||||
elEq.appendChild(plus);
|
||||
elEq.appendChild(g2);
|
||||
elEq.appendChild(eq);
|
||||
elEq.appendChild(g3);
|
||||
|
||||
updateTruthUI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function generateLevel(){
|
||||
resetPlayState();
|
||||
|
||||
|
||||
targetRemove = Math.min(2 + Math.floor(Math.log2(level + 1)), 6);
|
||||
|
||||
|
||||
let tries = 0;
|
||||
while(true){
|
||||
tries++;
|
||||
if(tries > 5000){
|
||||
targetRemove = Math.max(2, targetRemove - 1);
|
||||
tries = 0;
|
||||
}
|
||||
|
||||
const As = randInt(0, 9);
|
||||
const Bs = randInt(0, 9);
|
||||
const Cs = As + Bs;
|
||||
if(Cs < 0 || Cs > 9) continue;
|
||||
|
||||
|
||||
const Achoices = superDigits(As);
|
||||
const Bchoices = superDigits(Bs);
|
||||
const Cchoices = superDigits(Cs);
|
||||
|
||||
const Ashow = pick(Achoices);
|
||||
const Bshow = pick(Bchoices);
|
||||
const Cshow = pick(Cchoices);
|
||||
|
||||
const need =
|
||||
popcount(DIGIT_MASK[Ashow] ^ DIGIT_MASK[As]) +
|
||||
popcount(DIGIT_MASK[Bshow] ^ DIGIT_MASK[Bs]) +
|
||||
popcount(DIGIT_MASK[Cshow] ^ DIGIT_MASK[Cs]);
|
||||
|
||||
if(need !== targetRemove) continue;
|
||||
|
||||
|
||||
const shownTrue = (Ashow + Bshow) === Cshow;
|
||||
if(shownTrue) continue;
|
||||
|
||||
solution = { A: As, B: Bs, C: Cs };
|
||||
current = { A: Ashow, B: Bshow, C: Cshow };
|
||||
break;
|
||||
}
|
||||
|
||||
elLvl.textContent = String(level);
|
||||
elTarget.textContent = String(targetRemove);
|
||||
elGoalN.textContent = String(targetRemove);
|
||||
|
||||
elHint.innerHTML =
|
||||
`Level <b>${level}</b>: Make the equation true by removing <b>${targetRemove}</b> match(es). ` +
|
||||
`You can only remove sticks (click them).`;
|
||||
|
||||
renderEquation();
|
||||
syncRemovedCounts();
|
||||
updateTruthUI();
|
||||
}
|
||||
|
||||
function superDigits(baseDigit){
|
||||
const base = DIGIT_MASK[baseDigit];
|
||||
const res = [];
|
||||
for(let d=0; d<=9; d++){
|
||||
const m = DIGIT_MASK[d];
|
||||
if((m & base) === base){
|
||||
res.push(d);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
generateLevel();
|
||||
Reference in New Issue
Block a user