infp, progp
progp nicht fertig
This commit is contained in:
66
INF/sketch_dec13a/sketch_dec13a.ino
Normal file
66
INF/sketch_dec13a/sketch_dec13a.ino
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
const int Taster2 = 2;
|
||||||
|
const int LED_rot = 32;
|
||||||
|
enum Zustaende_t { zoff, zlow, znorm, zhigh } Zustand;
|
||||||
|
bool T_druck;
|
||||||
|
uint32_t zeit = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(Taster2, INPUT_PULLUP);
|
||||||
|
pinMode(LED_rot, OUTPUT);
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println("TEST - DANIEL");
|
||||||
|
ledcAttachChannel(LED_rot, 100, 12,0);
|
||||||
|
Zustand = zoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop (){
|
||||||
|
einlesen();
|
||||||
|
verarbeiten();
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void einlesen () {
|
||||||
|
static bool Neu, Alt;
|
||||||
|
Neu = digitalRead(Taster2);
|
||||||
|
if (Neu == 0 && Alt == 1) {
|
||||||
|
T_druck = true;
|
||||||
|
} else {
|
||||||
|
T_druck = false;
|
||||||
|
}
|
||||||
|
Alt = Neu;
|
||||||
|
}
|
||||||
|
void verarbeiten () {
|
||||||
|
switch (Zustand) {
|
||||||
|
case zoff: ledcWrite(LED_rot, 4095);
|
||||||
|
Serial.println("zoff ");
|
||||||
|
if (T_druck == true) {
|
||||||
|
Zustand = zlow;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case zlow: ledcWrite(LED_rot, 3071);
|
||||||
|
Serial.println("zlow");
|
||||||
|
if (T_druck == true){
|
||||||
|
Zustand = znorm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case znorm: ledcWrite(LED_rot, 2047);
|
||||||
|
Serial.println("znorm");
|
||||||
|
if (T_druck == true){
|
||||||
|
Zustand = zhigh;
|
||||||
|
zeit = millis();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case zhigh: ledcWrite(LED_rot, 0);
|
||||||
|
Serial.println("zhigh");
|
||||||
|
if (T_druck == true){
|
||||||
|
Zustand = zoff;
|
||||||
|
}
|
||||||
|
if (millis() - zeit >= 5000){
|
||||||
|
Zustand = znorm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Serial.println("default");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
204
progp/24-12-18 -- edicer3 functions/edicer-functions.php
Normal file
204
progp/24-12-18 -- edicer3 functions/edicer-functions.php
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>eDicer</title>
|
||||||
|
<style>
|
||||||
|
.text-bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.w {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
.ausgabe{
|
||||||
|
padding: 8px;
|
||||||
|
background-color: #333;
|
||||||
|
color: white;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.gewinn{
|
||||||
|
margin: 12px 0;
|
||||||
|
padding: 8px;
|
||||||
|
background-color: darkgreen;
|
||||||
|
color: white;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.board {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.wuerfeln {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||||
|
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
|
||||||
|
background-color: #44c767;
|
||||||
|
border-radius: 38px;
|
||||||
|
border: 1px solid #18ab29;
|
||||||
|
display: inline-block;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 23px 48px;
|
||||||
|
text-decoration: none;
|
||||||
|
animation: pulse-blur 1.5s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wuerfeln:active {
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
.wuerfeln:hover {
|
||||||
|
background-color: red;
|
||||||
|
box-shadow: 0px 0px 27px 8px red;
|
||||||
|
background: linear-gradient(to bottom, red 5%, red 100%);
|
||||||
|
border-radius: 38px;
|
||||||
|
border: 1px solid red;
|
||||||
|
animation: pulse-blur-hover 1.5s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse-blur {
|
||||||
|
25% {
|
||||||
|
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
box-shadow: 0px 0px 37px 12px #3dc21b;
|
||||||
|
}
|
||||||
|
75% {
|
||||||
|
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse-blur-hover {
|
||||||
|
25% {
|
||||||
|
box-shadow: 0px 0px 27px 8px red;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
box-shadow: 0px 0px 37px 12px red;
|
||||||
|
}
|
||||||
|
75% {
|
||||||
|
box-shadow: 0px 0px 27px 8px red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.kleine-info{
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.kopf-seite {
|
||||||
|
justify-content: center;
|
||||||
|
display: flex;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.ueberschrift {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
margin: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="kopf-seite">
|
||||||
|
<div>
|
||||||
|
<h1 class="ueberschrift">E DICER</h1><br>
|
||||||
|
<a class="wuerfeln" href="edicer-functions.php">Würfeln</a><br>
|
||||||
|
<div class="info">
|
||||||
|
<p class="kleine_info">Die Ergebnisse werden sortiert wie folgt sortiert: Klein >> Groß</p>
|
||||||
|
<p class="kleine_info">powered by Daniel</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="board">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// require_once "filename.php" <- Um andere Dateien einzubinden
|
||||||
|
|
||||||
|
$augen_array = [];
|
||||||
|
|
||||||
|
$anzahl = 5;
|
||||||
|
// Array füllen
|
||||||
|
for ($i=1; $i<=$anzahl; $i++){
|
||||||
|
$augen = rand(1,6);
|
||||||
|
$augen_array[] = $augen;
|
||||||
|
//echo "<img width = '10%' src = '/bilder/$augen.png' alt='$augen Augen'>\n";
|
||||||
|
}
|
||||||
|
// Array ausgeben
|
||||||
|
/*echo "<pre>";
|
||||||
|
print_r($augen_array);
|
||||||
|
echo"</pre>";
|
||||||
|
*/
|
||||||
|
sort($augen_array);
|
||||||
|
|
||||||
|
// Die Würfel zeigen
|
||||||
|
for ($i=0; $i<$anzahl; $i++){
|
||||||
|
echo "<img width = '10%' src = '../bilder/$augen_array[$i].png' alt='$augen_array[$i] Augen'>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ausgabe der Augenzahlen
|
||||||
|
$summe = array_sum($augen_array);
|
||||||
|
echo "<div class='ausgabe'>";
|
||||||
|
echo "<h2> Die Summe der Augenzahlen beträgt $summe </h2>";
|
||||||
|
echo "</div>";
|
||||||
|
echo "<div class='gewinn'>";
|
||||||
|
auswerten($augen_array);
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
|
// GEWINN ERMITTELN
|
||||||
|
function auswerten ($augen_arr){
|
||||||
|
|
||||||
|
$gewin_stufen = [
|
||||||
|
0 => ["kein gewinn", 0],
|
||||||
|
1 => ["Zweier Pasch", 1],
|
||||||
|
2 => ["Doppel zweierpasch", 2],
|
||||||
|
3 => ["Dreierpasch", 3], // 15%
|
||||||
|
4 => ["kleine straße", ], // 14%
|
||||||
|
5 => ["Full House", 10], // 4%
|
||||||
|
6 => ["große straße", 100], //3%
|
||||||
|
7 => ["Viererpasch", 10], // 2%
|
||||||
|
8 => ["Kniffel", 1000], // 0.1%
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$haeufigkeit = array_count_values($augen_arr);
|
||||||
|
sort($haeufigkeit);
|
||||||
|
// KNIFFEL
|
||||||
|
if (count(array_unique($augen_arr))==1){ // Fünf gleiche Zahlen = Kniffel
|
||||||
|
return "<h1>🎉 KNIFFEL! :) 🎉</h1><br><h2>5️⃣</h2>";
|
||||||
|
}
|
||||||
|
// VIERERPASCH
|
||||||
|
elseif ($haeufigkeit === [1,4]){ // das geht auch um 3 gleiche zu bekommen
|
||||||
|
return "<h1>4️⃣ VIERERPASCH :) 🎉</h1>";
|
||||||
|
}
|
||||||
|
// FULL HOUSE
|
||||||
|
elseif ($haeufigkeit === [2,3]) {
|
||||||
|
return "<h1>3️⃣ FULL HOUSE :) 🎉</h1>";
|
||||||
|
}
|
||||||
|
// DREIERPASCH
|
||||||
|
elseif ($haeufigkeit === [1,1,3]) {
|
||||||
|
return "<h1>3️⃣ DREIERPASCH :) 🎉</h1>";
|
||||||
|
}
|
||||||
|
// DOPPEL ZWEIERPASCH
|
||||||
|
elseif ($haeufigkeit === [1,2,2]) {
|
||||||
|
return "<h1>2️⃣ DOPPEL ZWEIERPASCH </h1>";
|
||||||
|
}
|
||||||
|
// ZWEIERPASCH
|
||||||
|
elseif ($haeufigkeit === [1,1,1,2]) {
|
||||||
|
return "<h1>2️⃣ ZWEIERPASCH :/ 🆗</h1>";
|
||||||
|
}
|
||||||
|
// KEIN GEWINN
|
||||||
|
else{
|
||||||
|
return "<h1>❌ KEIN GEWINN.❌</h1><br><h2>:( </h2>";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user