forked from zwickethomas/Photonics-Helfer
		
	add Abbildungsrechner
This commit is contained in:
		
							parent
							
								
									0da98417cd
								
							
						
					
					
						commit
						dc829019bc
					
				
							
								
								
									
										83
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								makefile
									
									
									
									
									
								
							@ -1,71 +1,24 @@
 | 
				
			|||||||
 | 
					CC = gcc
 | 
				
			||||||
 | 
					CPPFLAGS = -Iinclude -Isrc
 | 
				
			||||||
 | 
					CFLAGS = -Wall -pthread
 | 
				
			||||||
 | 
					LDLIBS = -lm -lpthread 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Start of system configuration section. ####
 | 
					SRC = src
 | 
				
			||||||
 | 
					OBJ = obj
 | 
				
			||||||
 | 
					BIN = Photonics-Helfer
 | 
				
			||||||
 | 
					MKDIR = mkdir -p
 | 
				
			||||||
 | 
					SRCs := $(shell find $(SRC) -name "*.c")
 | 
				
			||||||
 | 
					OBJs := $(subst $(SRC), $(OBJ), $(SRCs:.c=.o))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERSION := 2.00
 | 
					all: $(BIN)
 | 
				
			||||||
CC      := gcc -O
 | 
					 | 
				
			||||||
CFLAGS  := -Wall -c
 | 
					 | 
				
			||||||
LDFLAGS := -g
 | 
					 | 
				
			||||||
LIBS = -lm
 | 
					 | 
				
			||||||
RM      := rm
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### End of system configuration section. ####
 | 
					$(BIN): $(OBJs)
 | 
				
			||||||
 | 
						$(CC) $(CFLAGS) $(CPPFLAGS) $(OBJs) -o $@ $(LDLIBS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: all sort doc print clean
 | 
					$(OBJs): $(SRCs)
 | 
				
			||||||
 | 
						$(MKDIR) $(dir $@)
 | 
				
			||||||
 | 
						$(CC) $(CFLAGS) $(CPPFLAGS) -c $(subst $(OBJ), $(SRC), $(@:.o=.c)) -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TARGET.exe
 | 
					 | 
				
			||||||
TARGET     = Photonics-Helfer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Path for .c , .h and .o Files 
 | 
					 | 
				
			||||||
SRC_DIR = ./src/
 | 
					 | 
				
			||||||
OBJ_DIR = ./obj/
 | 
					 | 
				
			||||||
DOX_DIR = ./doc/doxygen/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Files to compile
 | 
					 | 
				
			||||||
c_FILES := $(wildcard $(SRC_DIR)/*.c)
 | 
					 | 
				
			||||||
o_FILES := $(addprefix obj/,$(notdir $(c_FILES:.c=.o)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#link all .o files
 | 
					 | 
				
			||||||
$(TARGET): $(o_FILES)
 | 
					 | 
				
			||||||
	@echo [CC] link: $<
 | 
					 | 
				
			||||||
	@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#compile all .c Files 
 | 
					 | 
				
			||||||
obj/%.o: src/%.c
 | 
					 | 
				
			||||||
	@echo [CC] compile: $<
 | 
					 | 
				
			||||||
	@$(CC) $(CFLAGS) -o $@ $<
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
#run TARGET.exe
 | 
					 | 
				
			||||||
run:
 | 
					 | 
				
			||||||
	$(TARGET)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
#create folders and sort files
 | 
					 | 
				
			||||||
sort:
 | 
					 | 
				
			||||||
	@-mkdir src obj
 | 
					 | 
				
			||||||
	@-mv *.c *.h src
 | 
					 | 
				
			||||||
	@-mv *.o obj
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
#create folde "doc" then run doxygen
 | 
					 | 
				
			||||||
doc:
 | 
					 | 
				
			||||||
	@echo need to start RunDoxy.bat manually
 | 
					 | 
				
			||||||
#	@-mkdir doc
 | 
					 | 
				
			||||||
#	@call $(DOX_DIR)RunDoxy.bat
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
# Clean all the object files and the binary
 | 
					 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	@echo "[Cleaning]"
 | 
						$(RM) -R $(BIN)
 | 
				
			||||||
	@$(RM) -rfv $(OBJ_DIR)*
 | 
						$(RM) -R $(OBJ)
 | 
				
			||||||
	@$(RM) -rfv $(TARGET).exe
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
help:
 | 
					 | 
				
			||||||
	@echo -e Version:   ' \t ' $(VERSION)
 | 
					 | 
				
			||||||
	@echo -e CC:       ' \t \t '  $(CC)
 | 
					 | 
				
			||||||
	@echo -e CFLAGS:   ' \t ' $(CFLAGS)
 | 
					 | 
				
			||||||
	@echo -e LDFLAGS:  ' \t ' $(LDFLAGS) ' \n ' 
 | 
					 | 
				
			||||||
	@echo    commands:
 | 
					 | 
				
			||||||
	@echo -e sort  ' \t \t ' sort files
 | 
					 | 
				
			||||||
	@echo -e run   ' \t \t ' run $(TARGET).exe
 | 
					 | 
				
			||||||
	@echo -e doc   ' \t \t ' run doxygen
 | 
					 | 
				
			||||||
	@echo -e clean ' \t \t ' clean all the .o
 | 
					 | 
				
			||||||
	@echo -e type make -help for more
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										413
									
								
								src/Fehlenden-vz/Fehlenden_Elektronik.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										413
									
								
								src/Fehlenden-vz/Fehlenden_Elektronik.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,413 @@
 | 
				
			|||||||
 | 
					/* Elektronikhelper
 | 
				
			||||||
 | 
					Dieses Programm ist eine Unterstzützung in der Elektronik.
 | 
				
			||||||
 | 
					Es berechnet leichte rechnungsschritte.
 | 
				
			||||||
 | 
					Autor: Elena und Philip MR1 Semester
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 14.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 14.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Bibliothek
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <math.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Hilfsfunktionen
 | 
				
			||||||
 | 
					#define PI 3.141592653589793
 | 
				
			||||||
 | 
					#define BOLTZMANN 1.380649e-23
 | 
				
			||||||
 | 
					#define ELEMENTARLADUNG 1.602176634e-19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Funktionen für Widerstandsberechnungen
 | 
				
			||||||
 | 
					void widerstand_berechnen() {
 | 
				
			||||||
 | 
					    double spannung, strom, widerstand;
 | 
				
			||||||
 | 
					    int auswahl;
 | 
				
			||||||
 | 
					    printf("\nWiderstandsberechnung (Ohmsches Gesetz):\n");
 | 
				
			||||||
 | 
					    printf("1. Widerstand berechnen\n");
 | 
				
			||||||
 | 
					    printf("2. Spannung berechnen\n");
 | 
				
			||||||
 | 
					    printf("3. Strom berechnen\n");
 | 
				
			||||||
 | 
					    printf("Wählen Sie eine Option: ");
 | 
				
			||||||
 | 
					    scanf("%d", &auswahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (auswahl) {
 | 
				
			||||||
 | 
					        case 1:
 | 
				
			||||||
 | 
					            printf("Spannung (in Volt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &spannung);
 | 
				
			||||||
 | 
					            printf("Strom (in Ampere): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &strom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (strom != 0) {
 | 
				
			||||||
 | 
					                widerstand = spannung / strom;
 | 
				
			||||||
 | 
					                printf("Der Widerstand beträgt %.2f Ohm.\n", widerstand);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                printf("Der Strom darf nicht null sein.\n");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        case 2:
 | 
				
			||||||
 | 
					            printf("Widerstand (in Ohm): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					            printf("Strom (in Ampere): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &strom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (widerstand > 0) {
 | 
				
			||||||
 | 
					                spannung = widerstand * strom;
 | 
				
			||||||
 | 
					                printf("Die Spannung beträgt %.2f Volt.\n", spannung);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                printf("Der Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        case 3:
 | 
				
			||||||
 | 
					            printf("Spannung (in Volt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &spannung);
 | 
				
			||||||
 | 
					            printf("Widerstand (in Ohm): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (widerstand > 0) {
 | 
				
			||||||
 | 
					                strom = spannung / widerstand;
 | 
				
			||||||
 | 
					                printf("Der Strom beträgt %.2f Ampere.\n", strom);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                printf("Der Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            printf("Ungültige Auswahl.\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void parallelschaltung_berechnen() {
 | 
				
			||||||
 | 
					    int anzahl;
 | 
				
			||||||
 | 
					    double widerstand, gesamtwiderstand = 0;
 | 
				
			||||||
 | 
					    printf("\nParallelschaltung von Widerständen:\n");
 | 
				
			||||||
 | 
					    printf("Anzahl der Widerstände: ");
 | 
				
			||||||
 | 
					    scanf("%d", &anzahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahl; i++) {
 | 
				
			||||||
 | 
					        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					        if (widerstand > 0) {
 | 
				
			||||||
 | 
					            gesamtwiderstand += 1 / widerstand;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            printf("Ein Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (gesamtwiderstand > 0) {
 | 
				
			||||||
 | 
					        gesamtwiderstand = 1 / gesamtwiderstand;
 | 
				
			||||||
 | 
					        printf("Der Gesamtwiderstand der Parallelschaltung beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void reihenschaltung_berechnen() {
 | 
				
			||||||
 | 
					    int anzahl;
 | 
				
			||||||
 | 
					    double widerstand, gesamtwiderstand = 0;
 | 
				
			||||||
 | 
					    printf("\nReihenschaltung von Widerständen:\n");
 | 
				
			||||||
 | 
					    printf("Anzahl der Widerstände: ");
 | 
				
			||||||
 | 
					    scanf("%d", &anzahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahl; i++) {
 | 
				
			||||||
 | 
					        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					        if (widerstand > 0) {
 | 
				
			||||||
 | 
					            gesamtwiderstand += widerstand;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            printf("Ein Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Der Gesamtwiderstand der Reihenschaltung beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void komplexe_schaltung_berechnen() {
 | 
				
			||||||
 | 
					    int anzahlReihen, anzahlParallel;
 | 
				
			||||||
 | 
					    double reihenWiderstand = 0, parallelWiderstand = 0, gesamtwiderstand = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("\nBerechnung komplexer Netzwerke:\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Reihenschaltung
 | 
				
			||||||
 | 
					    printf("Anzahl der Widerstände in der Reihenschaltung: ");
 | 
				
			||||||
 | 
					    scanf("%d", &anzahlReihen);
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahlReihen; i++) {
 | 
				
			||||||
 | 
					        double widerstand;
 | 
				
			||||||
 | 
					        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					        if (widerstand > 0) {
 | 
				
			||||||
 | 
					            reihenWiderstand += widerstand;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            printf("Ein Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Parallelschaltung
 | 
				
			||||||
 | 
					    printf("Anzahl der Widerstände in der Parallelschaltung: ");
 | 
				
			||||||
 | 
					    scanf("%d", &anzahlParallel);
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahlParallel; i++) {
 | 
				
			||||||
 | 
					        double widerstand;
 | 
				
			||||||
 | 
					        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					        if (widerstand > 0) {
 | 
				
			||||||
 | 
					            parallelWiderstand += 1 / widerstand;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            printf("Ein Widerstand muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (parallelWiderstand > 0) {
 | 
				
			||||||
 | 
					        parallelWiderstand = 1 / parallelWiderstand;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Gesamtwiderstand
 | 
				
			||||||
 | 
					    gesamtwiderstand = reihenWiderstand + parallelWiderstand;
 | 
				
			||||||
 | 
					    printf("Der Gesamtwiderstand des Netzwerks beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Spannungsteiler-Funktion
 | 
				
			||||||
 | 
					void spannungsteiler_berechnen() {
 | 
				
			||||||
 | 
					    int anzahl;
 | 
				
			||||||
 | 
					    double vin, vout, gesamtwiderstand = 0;
 | 
				
			||||||
 | 
					    printf("\nSpannungsteiler-Berechnung:\n");
 | 
				
			||||||
 | 
					    printf("Anzahl der Widerstände im Spannungsteiler: ");
 | 
				
			||||||
 | 
					    scanf("%d", &anzahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    double widerstaende[anzahl];
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahl; i++) {
 | 
				
			||||||
 | 
					        printf("Widerstand R%d (in Ohm): ", i + 1);
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstaende[i]);
 | 
				
			||||||
 | 
					        gesamtwiderstand += widerstaende[i];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Eingangsspannung Vin (in Volt): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &vin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < anzahl; i++) {
 | 
				
			||||||
 | 
					        vout = vin * (widerstaende[i] / gesamtwiderstand);
 | 
				
			||||||
 | 
					        printf("Spannung über R%d beträgt %.2f Volt.\n", i + 1, vout);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Leistungsberechnung
 | 
				
			||||||
 | 
					void leistung_berechnen() {
 | 
				
			||||||
 | 
					    double spannung, strom, leistung;
 | 
				
			||||||
 | 
					    int auswahl;
 | 
				
			||||||
 | 
					    printf("\nLeistungsberechnung:\n");
 | 
				
			||||||
 | 
					    printf("1. Leistung berechnen (benötigt Spannung und Strom)\n");
 | 
				
			||||||
 | 
					    printf("2. Spannung berechnen (benötigt Leistung und Strom)\n");
 | 
				
			||||||
 | 
					    printf("3. Strom berechnen (benötigt Leistung und Spannung)\n");
 | 
				
			||||||
 | 
					    printf("Wählen Sie eine Option: ");
 | 
				
			||||||
 | 
					    scanf("%d", &auswahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (auswahl) {
 | 
				
			||||||
 | 
					        case 1:
 | 
				
			||||||
 | 
					            printf("Spannung (in Volt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &spannung);
 | 
				
			||||||
 | 
					            printf("Strom (in Ampere): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &strom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            leistung = spannung * strom;
 | 
				
			||||||
 | 
					            printf("Die Leistung beträgt %.2f Watt.\n", leistung);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        case 2:
 | 
				
			||||||
 | 
					            printf("Leistung (in Watt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &leistung);
 | 
				
			||||||
 | 
					            printf("Strom (in Ampere): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &strom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (strom > 0) {
 | 
				
			||||||
 | 
					                spannung = leistung / strom;
 | 
				
			||||||
 | 
					                printf("Die Spannung beträgt %.2f Volt.\n", spannung);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                printf("Der Strom muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        case 3:
 | 
				
			||||||
 | 
					            printf("Leistung (in Watt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &leistung);
 | 
				
			||||||
 | 
					            printf("Spannung (in Volt): ");
 | 
				
			||||||
 | 
					            scanf("%lf", &spannung);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (spannung > 0) {
 | 
				
			||||||
 | 
					                strom = leistung / spannung;
 | 
				
			||||||
 | 
					                printf("Der Strom beträgt %.2f Ampere.\n", strom);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                printf("Die Spannung muss größer als null sein.\n");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            printf("Ungültige Auswahl.\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Weitere Funktionen (Dioden, Transistoren, Kondensatoren, LEDs, Knoten-/Maschenregel)
 | 
				
			||||||
 | 
					void dioden_berechnen() {
 | 
				
			||||||
 | 
					    double temperatur, schwellenspannung, is, strom;
 | 
				
			||||||
 | 
					    printf("\nDioden-Berechnung:\n");
 | 
				
			||||||
 | 
					    printf("Geben Sie die Temperatur (in Kelvin) ein: ");
 | 
				
			||||||
 | 
					    scanf("%lf", &temperatur);
 | 
				
			||||||
 | 
					    printf("Geben Sie den Sättigungsstrom Is (in Ampere) ein: ");
 | 
				
			||||||
 | 
					    scanf("%lf", &is);
 | 
				
			||||||
 | 
					    printf("Geben Sie die Schwellenspannung der Diode (in Volt) ein: ");
 | 
				
			||||||
 | 
					    scanf("%lf", &schwellenspannung);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    double vt = (BOLTZMANN * temperatur) / ELEMENTARLADUNG;
 | 
				
			||||||
 | 
					    strom = is * (exp(schwellenspannung / vt) - 1);
 | 
				
			||||||
 | 
					    printf("Der Strom durch die Diode beträgt %.6f Ampere.\n", strom);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void transistor_berechnen() {
 | 
				
			||||||
 | 
					    double verstaerkung, basisstrom, kollektorstrom, saettigungsspannung;
 | 
				
			||||||
 | 
					    printf("\nTransistor-Berechnung:\n");
 | 
				
			||||||
 | 
					    printf("Verstärkungsfaktor (hFE): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &verstaerkung);
 | 
				
			||||||
 | 
					    printf("Basisstrom (in Ampere): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &basisstrom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    kollektorstrom = verstaerkung * basisstrom;
 | 
				
			||||||
 | 
					    printf("Der Kollektorstrom beträgt %.6f Ampere.\n", kollektorstrom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Sättigungsspannung (in Volt): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &saettigungsspannung);
 | 
				
			||||||
 | 
					    printf("Die Sättigungsspannung beträgt %.2f Volt.\n", saettigungsspannung);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void kondensator_berechnen() {
 | 
				
			||||||
 | 
					    double kapazitaet, spannung, energie, zeit, widerstand;
 | 
				
			||||||
 | 
					    printf("\nKondensator-Berechnung:\n");
 | 
				
			||||||
 | 
					    printf("kapazität (in Farad): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &kapazitaet);
 | 
				
			||||||
 | 
					    printf("Spannung (in Volt): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &spannung);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    energie = 0.5 * kapazitaet * pow(spannung, 2);
 | 
				
			||||||
 | 
					    printf("Die Energie im Kondensator beträgt %.6f Joule.\n", energie);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Entladezeit berechnen? (1 für Ja, 0 für Nein): ");
 | 
				
			||||||
 | 
					    int wahl;
 | 
				
			||||||
 | 
					    scanf("%d", &wahl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (wahl == 1) {
 | 
				
			||||||
 | 
					        printf("Widerstand (in Ohm): ");
 | 
				
			||||||
 | 
					        scanf("%lf", &widerstand);
 | 
				
			||||||
 | 
					        zeit = kapazitaet * widerstand;
 | 
				
			||||||
 | 
					        printf("Die Zeitkonstante betraegt %.2f Sekunden.\n", zeit);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void led_vorwiderstand_berechnen() {
 | 
				
			||||||
 | 
					    double betriebsspannung, durchlassspannung, strom, vorwiderstand, verlustleistung;
 | 
				
			||||||
 | 
					    printf("\nLED-Vorwiderstandsberechnung:\n");
 | 
				
			||||||
 | 
					    printf("Betriebsspannung (in Volt): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &betriebsspannung);
 | 
				
			||||||
 | 
					    printf("Durchlassspannung der LED (in Volt): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &durchlassspannung);
 | 
				
			||||||
 | 
					    printf("Strom durch die LED (in Ampere): ");
 | 
				
			||||||
 | 
					    scanf("%lf", &strom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vorwiderstand = (betriebsspannung - durchlassspannung) / strom;
 | 
				
			||||||
 | 
					    verlustleistung = pow((betriebsspannung - durchlassspannung), 2) / vorwiderstand;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Der Vorwiderstand beträgt %.2f Ohm.\n", vorwiderstand);
 | 
				
			||||||
 | 
					    printf("Die maximale Verlustleistung des Widerstands beträgt %.2f Watt.\n", verlustleistung);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void knotenregel_berechnen() {
 | 
				
			||||||
 | 
					    int n;  // Anzahl der Ströme und Spannungen
 | 
				
			||||||
 | 
					    float sum_current = 0.0, current;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Knotenregel: Ströme berechnen
 | 
				
			||||||
 | 
					    printf("Geben Sie die Anzahl der Stroeme ein im Knoten: ");
 | 
				
			||||||
 | 
					    scanf("%d", &n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Geben Sie die Stroeme ein (in Ampere):\n");
 | 
				
			||||||
 | 
					    for (int i = 1; i <= n; i++) {
 | 
				
			||||||
 | 
					        printf("Strom %d: ", i);
 | 
				
			||||||
 | 
					        scanf("%f", ¤t);
 | 
				
			||||||
 | 
					        sum_current += current;  // Ströme addieren
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("\nSumme der Ströme: %.2f A\n", sum_current);
 | 
				
			||||||
 | 
					    if (sum_current == 0) {
 | 
				
			||||||
 | 
					        printf("Der Knoten erfüllt die Knotenregel (Summe der Ströme ist null).\n");
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        printf("Der Knoten erfüllt die Knotenregel nicht (Summe der Ströme ist %.2f).\n", sum_current);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void maschenregel_berechnen() {
 | 
				
			||||||
 | 
					    int n;  // Anzahl der Ströme und Spannungen
 | 
				
			||||||
 | 
					    float sum_voltage = 0.0, voltage;
 | 
				
			||||||
 | 
					    // Maschenregel: Spannungen berechnen
 | 
				
			||||||
 | 
					    printf("\nGeben Sie die Anzahl der Spannungen in einer Masche ein: ");
 | 
				
			||||||
 | 
					    scanf("%d", &n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Geben Sie die Spannungen ein (in Volt):\n");
 | 
				
			||||||
 | 
					    for (int i = 1; i <= n; i++) {
 | 
				
			||||||
 | 
					        printf("Spannung %d: ", i);
 | 
				
			||||||
 | 
					        scanf("%f", &voltage);
 | 
				
			||||||
 | 
					        sum_voltage += voltage;  // Spannungen addieren
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Überprüfung der Maschenregel
 | 
				
			||||||
 | 
					    printf("\nSumme der Spannungen: %.2f V\n", sum_voltage);
 | 
				
			||||||
 | 
					    if (sum_voltage == 0) {
 | 
				
			||||||
 | 
					        printf("Die Masche erfüllt die Maschenregel (Summe der Spannungen ist null).\n");
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        printf("Die Masche erfüllt die Maschenregel nicht (Summe der Spannungen ist %.2f).\n", sum_voltage);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int Fehlenden_Elektronik_main() {
 | 
				
			||||||
 | 
					    char auswahl[21] = {0};
 | 
				
			||||||
 | 
					    long auswahl_int = 0;
 | 
				
			||||||
 | 
					    char *endptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    do {
 | 
				
			||||||
 | 
					        printf("\nElektronik-Berechnungstool:\n");
 | 
				
			||||||
 | 
					        printf("1. Widerstandsberechnung (Ohmsches Gesetz)\n");
 | 
				
			||||||
 | 
					        printf("2. Parallelschaltung von Widerständen\n");
 | 
				
			||||||
 | 
					        printf("3. Reihenschaltung von Widerständen\n");
 | 
				
			||||||
 | 
					        printf("4. Komplexe Netzwerke\n");
 | 
				
			||||||
 | 
					        printf("5. Spannungsteiler\n");
 | 
				
			||||||
 | 
					        printf("6. Leistungsberechnung\n");
 | 
				
			||||||
 | 
					        printf("7. Dioden-Berechnung\n");
 | 
				
			||||||
 | 
					        printf("8. Transistor-Berechnung\n");
 | 
				
			||||||
 | 
					        printf("9. Kondensator-Berechnung\n");
 | 
				
			||||||
 | 
					        printf("10. LED-Vorwiderstandsberechnung\n");
 | 
				
			||||||
 | 
					        printf("11. Knotenregel-Berechnung\n");
 | 
				
			||||||
 | 
					        printf("12. Maschenregel-Berechnung\n");
 | 
				
			||||||
 | 
					        printf("0. Beenden\n");
 | 
				
			||||||
 | 
					        printf("Wählen Sie eine Option: ");
 | 
				
			||||||
 | 
					        scanf("%20s", auswahl);
 | 
				
			||||||
 | 
					        auswahl_int = strtol((const char*)auswahl, &endptr, 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (*endptr != 0){
 | 
				
			||||||
 | 
					            auswahl_int = -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (*endptr == 'q'){
 | 
				
			||||||
 | 
					        return 10;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        switch (auswahl_int) {
 | 
				
			||||||
 | 
					            case 1: widerstand_berechnen(); break;
 | 
				
			||||||
 | 
					            case 2: parallelschaltung_berechnen(); break;
 | 
				
			||||||
 | 
					            case 3: reihenschaltung_berechnen(); break;
 | 
				
			||||||
 | 
					            case 4: komplexe_schaltung_berechnen(); break;
 | 
				
			||||||
 | 
					            case 5: spannungsteiler_berechnen(); break;
 | 
				
			||||||
 | 
					            case 6: leistung_berechnen(); break;
 | 
				
			||||||
 | 
					            case 7: dioden_berechnen(); break;
 | 
				
			||||||
 | 
					            case 8: transistor_berechnen(); break;
 | 
				
			||||||
 | 
					            case 9: kondensator_berechnen(); break;
 | 
				
			||||||
 | 
					            case 10: led_vorwiderstand_berechnen(); break;
 | 
				
			||||||
 | 
					            case 11: knotenregel_berechnen(); break;
 | 
				
			||||||
 | 
					            case 12: maschenregel_berechnen(); break;
 | 
				
			||||||
 | 
					            case 0: printf("Programm beendet.\n"); break;
 | 
				
			||||||
 | 
					            default: printf("Ungültige Auswahl.\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } while (auswahl_int != 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/Fehlenden-vz/Fehlenden_Elektronik.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Fehlenden-vz/Fehlenden_Elektronik.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#ifndef Fehlenden_Elektronik_H_ 
 | 
				
			||||||
 | 
					#define Fehlenden_Elektronik_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					// #define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   // extern int kbhit();
 | 
				
			||||||
 | 
					   int Fehlenden_Elektronik_main();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										34
									
								
								src/Main-vz/kbhit_linux.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/Main-vz/kbhit_linux.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <termios.h>
 | 
				
			||||||
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					#include <fcntl.h>
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					int kbhit(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  struct termios oldt, newt;
 | 
				
			||||||
 | 
					  int ch;
 | 
				
			||||||
 | 
					  int oldf;
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  tcgetattr(STDIN_FILENO, &oldt);
 | 
				
			||||||
 | 
					  newt = oldt;
 | 
				
			||||||
 | 
					  newt.c_lflag &= ~(ICANON | ECHO);
 | 
				
			||||||
 | 
					  tcsetattr(STDIN_FILENO, TCSANOW, &newt);
 | 
				
			||||||
 | 
					  oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
 | 
				
			||||||
 | 
					  fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  ch = getchar();
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
 | 
				
			||||||
 | 
					  fcntl(STDIN_FILENO, F_SETFL, oldf);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  if(ch != EOF)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    ungetc(ch, stdin);
 | 
				
			||||||
 | 
					    return 1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										6
									
								
								src/Main-vz/kbhit_linux.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/Main-vz/kbhit_linux.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#ifndef KBHIT_LINUX_H_ 
 | 
				
			||||||
 | 
					#define KBHIT_LINUX_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int kbhit();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										109
									
								
								src/Main-vz/pipes2.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								src/Main-vz/pipes2.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,109 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #include <termios.h>
 | 
				
			||||||
 | 
					// #include <fcntl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					#include "kbhit_linux.h"
 | 
				
			||||||
 | 
					#elif _WIN32
 | 
				
			||||||
 | 
					    #include <windows.h>
 | 
				
			||||||
 | 
					    #include <conio.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define GRID_GROESSE_X 200
 | 
				
			||||||
 | 
					#define GRID_GROESSE_Y 60
 | 
				
			||||||
 | 
					#define SLEEP_TIME 40000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RED "\033[31m"
 | 
				
			||||||
 | 
					#define GREEN "\033[32m"
 | 
				
			||||||
 | 
					#define YELLOW "\033[33m"
 | 
				
			||||||
 | 
					#define BLUE "\033[34m"
 | 
				
			||||||
 | 
					#define MAGENTA "\033[35m"
 | 
				
			||||||
 | 
					#define CYAN "\033[36m"
 | 
				
			||||||
 | 
					#define WHITE "\033[37m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *colors2[] = {RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int randome(int max){
 | 
				
			||||||
 | 
					    return rand() % max;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void print_at(int x, int y, char c[4], char color)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   printf("%s\033[%d;%dH%s", colors2[color], y, x, c);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char print_pipe(int *x, int *y, int x_max, int y_max, int length, char direction, char direction_old, char *color){
 | 
				
			||||||
 | 
					    if ((direction == 0 && direction_old == 1) || (direction == 1 && direction_old == 0)){
 | 
				
			||||||
 | 
					        return direction_old;
 | 
				
			||||||
 | 
					    } else if ((direction == 2 && direction_old == 3) || (direction == 3 && direction_old == 2)){
 | 
				
			||||||
 | 
					        return direction_old;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    bool start = true;
 | 
				
			||||||
 | 
					    for(int i = 0; i < length; i++){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (start && direction != direction_old){
 | 
				
			||||||
 | 
					            switch (direction_old){
 | 
				
			||||||
 | 
					                case 0: *y -= 1; if (*y <= 0){ *y = y_max; *color = randome(7); } break; // up
 | 
				
			||||||
 | 
					                case 1: *y += 1; if (*y > y_max){ *y = 0; *color = randome(7); } break; // down
 | 
				
			||||||
 | 
					                case 2: *x -= 1; if (*x <= 0){ *x = x_max; *color = randome(7); } break; // left
 | 
				
			||||||
 | 
					                case 3: *x += 1; if (*x >= x_max){ *x = 0; *color = randome(7); } break; // rigth
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if ((direction == 2 && direction_old == 0) || (direction == 1 && direction_old == 3)){
 | 
				
			||||||
 | 
					                print_at(*x, *y, "┓", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 0 && direction_old == 2) || (direction == 3 && direction_old == 1)) {
 | 
				
			||||||
 | 
					                print_at(*x, *y, "┗", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 3 && direction_old == 0) || (direction == 1 && direction_old == 2)) {
 | 
				
			||||||
 | 
					                print_at(*x, *y, "┏", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 0 && direction_old == 3) || (direction == 2 && direction_old == 1)) {
 | 
				
			||||||
 | 
					                print_at(*x, *y, "┛", *color);
 | 
				
			||||||
 | 
					            } // else { printf("\nd = %i | d_o = %i\n", direction, direction_old); }
 | 
				
			||||||
 | 
					            start = false;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            switch (direction){
 | 
				
			||||||
 | 
					                case 0: *y -= 1; if (*y <= 0){ *y = y_max; *color = randome(7); } break; // up
 | 
				
			||||||
 | 
					                case 1: *y += 1; if (*y > y_max){ *y = 0; *color = randome(7); } break; // down
 | 
				
			||||||
 | 
					                case 2: *x -= 1; if (*x <= 0){ *x = x_max; *color = randome(7); } break; // left
 | 
				
			||||||
 | 
					                case 3: *x += 1; if (*x >= x_max){ *x = 0; *color = randome(7); } break; // rigth
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (direction <= 1) {
 | 
				
			||||||
 | 
					                print_at(*x, *y, "┃", *color);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                print_at(*x, *y, "━", *color);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        fflush(stdout);
 | 
				
			||||||
 | 
					        usleep(SLEEP_TIME);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return direction;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int pipes_2(int width, int height){
 | 
				
			||||||
 | 
					    int x_max = width;
 | 
				
			||||||
 | 
					    int y_max =height;
 | 
				
			||||||
 | 
					    int x = width / 2;
 | 
				
			||||||
 | 
					    int y = height / 2;
 | 
				
			||||||
 | 
					    char direction_old = 0;
 | 
				
			||||||
 | 
					    char color = 6;
 | 
				
			||||||
 | 
					    int start_time = 0;
 | 
				
			||||||
 | 
					    srand(time(0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while(!kbhit()){
 | 
				
			||||||
 | 
					        if (start_time + 20 <= time(0)){
 | 
				
			||||||
 | 
					            printf("\e[1;1H\e[2J"); // clear terminal
 | 
				
			||||||
 | 
					            start_time = time(0);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        direction_old = print_pipe(&x, &y, x_max, y_max, randome(height / 3) + 1, randome(4), direction_old, &color);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // ist dazu da um "\n" aus dem buffer zu entfernen!
 | 
				
			||||||
 | 
					    getchar();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("\033[00m"); // Farbe zurücksetzen
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/Main-vz/pipes2.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Main-vz/pipes2.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#ifndef pipes2_H_
 | 
				
			||||||
 | 
					#define pipes2_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					// #define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// extern int pipes(int width, int height);
 | 
				
			||||||
 | 
					int pipes_2(int width, int height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										158
									
								
								src/Main-vz/pipes2_game.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								src/Main-vz/pipes2_game.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,158 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					    #include <sys/ioctl.h>
 | 
				
			||||||
 | 
					    #include <unistd.h>
 | 
				
			||||||
 | 
					    #include <termio.h>
 | 
				
			||||||
 | 
					#elif _WIN32
 | 
				
			||||||
 | 
					    #include <windows.h>
 | 
				
			||||||
 | 
					    #include <conio.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #include <termios.h>
 | 
				
			||||||
 | 
					// #include <fcntl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					#include "kbhit_linux.h"
 | 
				
			||||||
 | 
					#elif _WIN32
 | 
				
			||||||
 | 
					    #include <windows.h>
 | 
				
			||||||
 | 
					    #include <conio.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define GRID_GROESSE_X 200
 | 
				
			||||||
 | 
					#define GRID_GROESSE_Y 60
 | 
				
			||||||
 | 
					#define SLEEP_TIME 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RED "\033[31m"
 | 
				
			||||||
 | 
					#define GREEN "\033[32m"
 | 
				
			||||||
 | 
					#define YELLOW "\033[33m"
 | 
				
			||||||
 | 
					#define BLUE "\033[34m"
 | 
				
			||||||
 | 
					#define MAGENTA "\033[35m"
 | 
				
			||||||
 | 
					#define CYAN "\033[36m"
 | 
				
			||||||
 | 
					#define WHITE "\033[37m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *colors3[] = {RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					int getch_pipese(){ 
 | 
				
			||||||
 | 
					    int ch;
 | 
				
			||||||
 | 
					    struct termios oldattr, newattr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    tcgetattr(STDIN_FILENO, &oldattr);
 | 
				
			||||||
 | 
					    newattr = oldattr;
 | 
				
			||||||
 | 
					    newattr.c_lflag &= ~ICANON;
 | 
				
			||||||
 | 
					    newattr.c_lflag &= ~ECHO;
 | 
				
			||||||
 | 
					    newattr.c_cc[VMIN] = 1;
 | 
				
			||||||
 | 
					    newattr.c_cc[VTIME] = 0;
 | 
				
			||||||
 | 
					    tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
 | 
				
			||||||
 | 
					    ch = getchar();
 | 
				
			||||||
 | 
					    tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return ch; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int randomee(int max){
 | 
				
			||||||
 | 
					    return rand() % max;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void print_ate(int x, int y, char c[4], char color)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   printf("%s\033[%d;%dH%s", colors3[color], y, x, c);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char print_pipee(int *x, int *y, int x_max, int y_max, int length, char direction, char direction_old, char *color){
 | 
				
			||||||
 | 
					    if ((direction == 0 && direction_old == 1) || (direction == 1 && direction_old == 0)){
 | 
				
			||||||
 | 
					        return direction_old;
 | 
				
			||||||
 | 
					    } else if ((direction == 2 && direction_old == 3) || (direction == 3 && direction_old == 2)){
 | 
				
			||||||
 | 
					        return direction_old;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    bool start = true;
 | 
				
			||||||
 | 
					    for(int i = 0; i < length; i++){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (start && direction != direction_old){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            switch (direction_old){
 | 
				
			||||||
 | 
					                case 0: *y -= 1; if (*y <= 0){ *y = y_max; *color = randomee(7); } break; // up
 | 
				
			||||||
 | 
					                case 1: *y += 1; if (*y > y_max){ *y = 0; *color = randomee(7); } break; // down
 | 
				
			||||||
 | 
					                case 2: *x -= 1; if (*x <= 0){ *x = x_max; *color = randomee(7); } break; // left
 | 
				
			||||||
 | 
					                case 3: *x += 1; if (*x >= x_max){ *x = 0; *color = randomee(7); } break; // rigth
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if ((direction == 2 && direction_old == 0) || (direction == 1 && direction_old == 3)){
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "┓", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 0 && direction_old == 2) || (direction == 3 && direction_old == 1)) {
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "┗", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 3 && direction_old == 0) || (direction == 1 && direction_old == 2)) {
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "┏", *color);
 | 
				
			||||||
 | 
					            } else if ((direction == 0 && direction_old == 3) || (direction == 2 && direction_old == 1)) {
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "┛", *color);
 | 
				
			||||||
 | 
					            } // else { printf("\nd = %i | d_o = %i\n", direction, direction_old); }
 | 
				
			||||||
 | 
					            start = false;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            switch (direction){
 | 
				
			||||||
 | 
					                case 0: *y -= 1; if (*y <= 0){ *y = y_max; *color = randomee(7); } break; // up
 | 
				
			||||||
 | 
					                case 1: *y += 1; if (*y > y_max){ *y = 0; *color = randomee(7); } break; // down
 | 
				
			||||||
 | 
					                case 2: *x -= 1; if (*x <= 0){ *x = x_max; *color = randomee(7); } break; // left
 | 
				
			||||||
 | 
					                case 3: *x += 1; if (*x >= x_max){ *x = 0; *color = randomee(7); } break; // rigth
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (direction <= 1) {
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "┃", *color);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                print_ate(*x, *y, "━", *color);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        fflush(stdout);
 | 
				
			||||||
 | 
					        usleep(SLEEP_TIME);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return direction;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int pipes_2_game(int width, int height){
 | 
				
			||||||
 | 
					    int x_max = width;
 | 
				
			||||||
 | 
					    int y_max =height;
 | 
				
			||||||
 | 
					    int x = width / 2;
 | 
				
			||||||
 | 
					    int y = height / 2;
 | 
				
			||||||
 | 
					    char direction_old = 0;
 | 
				
			||||||
 | 
					    char color = 6;
 | 
				
			||||||
 | 
					    int start_time = 0;
 | 
				
			||||||
 | 
					    srand(time(0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while(!kbhit()){
 | 
				
			||||||
 | 
					        int richtung = 0;
 | 
				
			||||||
 | 
					        int length = 4;
 | 
				
			||||||
 | 
					        if (start_time + 20 <= time(0)){
 | 
				
			||||||
 | 
					            printf("\e[1;1H\e[2J"); // clear terminal
 | 
				
			||||||
 | 
					            start_time = time(0);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            #ifdef __linux__
 | 
				
			||||||
 | 
					                char key_input = (char)getch_pipese();
 | 
				
			||||||
 | 
					            #elif _WIN32
 | 
				
			||||||
 | 
					                char key_input = (char)getch();
 | 
				
			||||||
 | 
					            #endif
 | 
				
			||||||
 | 
					            switch (key_input) {
 | 
				
			||||||
 | 
					                case 'h': richtung = 2; break;
 | 
				
			||||||
 | 
					                case 'a': richtung = 2; break;
 | 
				
			||||||
 | 
					                case 'l': richtung = 3; break;
 | 
				
			||||||
 | 
					                case 'd': richtung = 3; break;
 | 
				
			||||||
 | 
					                case 'j': richtung = 1; break;
 | 
				
			||||||
 | 
					                case 's': richtung = 1; break;
 | 
				
			||||||
 | 
					                case 'k': richtung = 0; break;
 | 
				
			||||||
 | 
					                case 'w': richtung = 0; break;
 | 
				
			||||||
 | 
					                case 'q': return 0;
 | 
				
			||||||
 | 
					                default: continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        direction_old = print_pipee(&x, &y, x_max, y_max, length, richtung, direction_old, &color);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // ist dazu da um "\n" aus dem buffer zu entfernen!
 | 
				
			||||||
 | 
					    getchar();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("\033[00m"); // Farbe zurücksetzen
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/Main-vz/pipes2_game.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Main-vz/pipes2_game.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					#ifndef pipes2_game_H_
 | 
				
			||||||
 | 
					#define pipes2_game_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					// #define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// extern int pipes(int width, int height);
 | 
				
			||||||
 | 
					int pipes_2_game(int width, int height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										384
									
								
								src/Main-vz/pipes_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										384
									
								
								src/Main-vz/pipes_test.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,384 @@
 | 
				
			|||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					    #include <sys/ioctl.h>
 | 
				
			||||||
 | 
					    #include <unistd.h>
 | 
				
			||||||
 | 
					    #include <termio.h>
 | 
				
			||||||
 | 
					#elif _WIN32
 | 
				
			||||||
 | 
					    #include <windows.h>
 | 
				
			||||||
 | 
					    #include <conio.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define DEBUGGER_PIPES_TO_NUMBERS 0
 | 
				
			||||||
 | 
					#define DEBUGGER_RANDOM 0
 | 
				
			||||||
 | 
					#define AUTOMATISCH 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define INFILL_PLAIN_PAPER 0
 | 
				
			||||||
 | 
					#define INFILL_X_PIPE 1
 | 
				
			||||||
 | 
					#define INFILL_Y_PIPE 2
 | 
				
			||||||
 | 
					#define FILLER " "                      // ░
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//#define GRID_GROESSE_X 120              // x:y -> 2:1 for a square looking grid
 | 
				
			||||||
 | 
					//#define GRID_GROESSE_Y 60
 | 
				
			||||||
 | 
					#define MIN_LAENGE_PIPE 6
 | 
				
			||||||
 | 
					#define MAX_LAENGE_PIPE 6
 | 
				
			||||||
 | 
					#define SLEEP_TIMER 0              // in nano seconds
 | 
				
			||||||
 | 
					// #define SLEEP_TIMER 5000              // in nano seconds
 | 
				
			||||||
 | 
					#define COLOR_CHANGING_PROBABILITY 5   // format: "(1 : your_number)", for every direction change
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RESET_COLOR "\033[0m"
 | 
				
			||||||
 | 
					#define RED "\033[31m"
 | 
				
			||||||
 | 
					#define GREEN "\033[32m"
 | 
				
			||||||
 | 
					#define YELLOW "\033[33m"
 | 
				
			||||||
 | 
					#define BLUE "\033[34m"
 | 
				
			||||||
 | 
					#define MAGENTA "\033[35m"
 | 
				
			||||||
 | 
					#define CYAN "\033[36m"
 | 
				
			||||||
 | 
					#define WHITE "\033[37m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char* color;
 | 
				
			||||||
 | 
					const char *colors[] = {RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void random_color() {
 | 
				
			||||||
 | 
					    color = colors[rand() % (sizeof(colors) / sizeof(colors[0]))];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __linux__
 | 
				
			||||||
 | 
					int getch_pipes(){ 
 | 
				
			||||||
 | 
					    int ch;
 | 
				
			||||||
 | 
					    struct termios oldattr, newattr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    tcgetattr(STDIN_FILENO, &oldattr);
 | 
				
			||||||
 | 
					    newattr = oldattr;
 | 
				
			||||||
 | 
					    newattr.c_lflag &= ~ICANON;
 | 
				
			||||||
 | 
					    newattr.c_lflag &= ~ECHO;
 | 
				
			||||||
 | 
					    newattr.c_cc[VMIN] = 1;
 | 
				
			||||||
 | 
					    newattr.c_cc[VTIME] = 0;
 | 
				
			||||||
 | 
					    tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
 | 
				
			||||||
 | 
					    ch = getchar();
 | 
				
			||||||
 | 
					    tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return ch; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int print_grid(int x, int y, char **grid, int how_many_targets, int *lul) {
 | 
				
			||||||
 | 
					    int target_count = 0;
 | 
				
			||||||
 | 
					    for (int i = 0; i < y; i++) {
 | 
				
			||||||
 | 
					        printf("\n");
 | 
				
			||||||
 | 
					        for (int j = 0; j < x; j++) {
 | 
				
			||||||
 | 
					            if(grid[i][j] == 3){
 | 
				
			||||||
 | 
					                target_count += 1;
 | 
				
			||||||
 | 
					            }if (!DEBUGGER_PIPES_TO_NUMBERS){
 | 
				
			||||||
 | 
					                if(grid[i][j] == 0){
 | 
				
			||||||
 | 
					                    printf(FILLER);
 | 
				
			||||||
 | 
					                } else if(grid[i][j] == 3){
 | 
				
			||||||
 | 
					                    printf("%s█","\033[31m" );
 | 
				
			||||||
 | 
					                } else if(grid[i][j] != 0 && grid[i][j] != 1 && grid[i][j] != 2 && grid[i][j] != 3){
 | 
				
			||||||
 | 
					                    return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 0 && grid[i][j - 1] != 0 && grid[i][j + 1] != 0 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] != 0 && grid[i + 1][j] != 0 && grid[i][j - 1] == 0 && grid[i][j + 1] == 0 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s╋", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 2 && grid[i][j - 1] == 1 && grid[i][j + 1] == 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┓", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 0 && grid[i][j - 1] == 0 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┗", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 2 && grid[i][j - 1] == 0 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┏", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 0 && grid[i][j - 1] == 1 && grid[i][j + 1] == 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┛", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 0 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┣", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 1 && grid[i][j + 1] == 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┫", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 2 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┳", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 0 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┻", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 0 && grid[i][j - 1] != 0 && grid[i][j + 1] == 0 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 0 && grid[i][j - 1] == 0 && grid[i][j + 1] != 0 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] != 0 && grid[i + 1][j] == 0 && grid[i][j - 1] == 0 && grid[i][j + 1] == 0 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] != 0 && grid[i][j - 1] == 0 && grid[i][j + 1] == 0 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 1 && grid[i + 1][j] == 0 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] == 1 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 1 && grid[i + 1][j] == 1 && grid[i][j - 1] == 1 && grid[i][j + 1] == 1 && grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 0 && grid[i][j + 1] == 2 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 2 && grid[i][j + 1] == 0 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 2 && grid[i + 1][j] == 2 && grid[i][j - 1] == 2 && grid[i][j + 1] == 2 && grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i][j] == 3){
 | 
				
			||||||
 | 
					                    printf("✨");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] != 0 && grid[i + 1][j] != 0 && grid[i][j - 1] != 0 && grid[i][j + 1] != 0 && grid[i][j] == 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] != 0 && grid[i + 1][j] != 0 && grid[i][j - 1] != 0 && grid[i][j + 1] == 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] != 0 && grid[i + 1][j] == 0 && grid[i][j - 1] != 0 && grid[i][j + 1] != 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┻", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j] == 0 && grid[i + 1][j] != 0 && grid[i][j - 1] != 0 && grid[i][j + 1] != 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┳", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i - 1][j + 1] == 0 && grid[i - 1][j] != 0 && grid[i + 1][j] != 0 && grid[i][j - 1] != 0 && grid[i][j + 1] != 0 && grid[i][j] != 0  ){
 | 
				
			||||||
 | 
					                    printf("%s┗", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i][j] == 2  ){
 | 
				
			||||||
 | 
					                    printf("%s┃", color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else if(grid[i][j] == 1  ){
 | 
				
			||||||
 | 
					                    printf("%s━", color);
 | 
				
			||||||
 | 
					                } else{printf("x");}
 | 
				
			||||||
 | 
					                    printf(RESET_COLOR); // Setzt die Farbe zurück
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                printf("%i", grid[i][j]);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (target_count <= 2*how_many_targets - 1*how_many_targets) {
 | 
				
			||||||
 | 
					        printf("\e[1;1H\e[2J");
 | 
				
			||||||
 | 
					        printf("\n");
 | 
				
			||||||
 | 
					        printf(" █     █   █████   █     █    █      █   █████   ██   █\n");
 | 
				
			||||||
 | 
					        printf(" ██   ██  █     █  █     █    █      █  █     █  ███  █\n");
 | 
				
			||||||
 | 
					        printf("  █████   █     █  █     █    █      █  █     █  █ ██ █\n");
 | 
				
			||||||
 | 
					        printf("    █     █     █  █     █     █ ██ █   █     █  █  ███\n");
 | 
				
			||||||
 | 
					        printf("    █      █████    █████       █  █     █████   █   ██\n");
 | 
				
			||||||
 | 
					        printf("\n");
 | 
				
			||||||
 | 
					        printf("Targets overritten: %i\n", 2*how_many_targets-target_count);
 | 
				
			||||||
 | 
					        *lul += 1;
 | 
				
			||||||
 | 
					        system("xdg-open https://bit.ly/3BlS71b");
 | 
				
			||||||
 | 
					        printf("'q' for start menue");
 | 
				
			||||||
 | 
					        return 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int generate_pipe_x(int GRID_GROESSE_X, int GRID_GROESSE_Y, char **grid, int *x_start, int *y_start, int laenge, int how_many_targets, int *return_code, int *lul) {
 | 
				
			||||||
 | 
					    if (laenge < 0){
 | 
				
			||||||
 | 
					        for (int i = *x_start; i > *x_start + laenge; i--) {
 | 
				
			||||||
 | 
					            if (*return_code == 1) {
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (i <= -laenge/2 -1) {
 | 
				
			||||||
 | 
					                *x_start = GRID_GROESSE_X + laenge/2;
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            grid[*y_start][i] = INFILL_X_PIPE;
 | 
				
			||||||
 | 
					            printf("\33[H\033[J");
 | 
				
			||||||
 | 
					            *return_code = print_grid(GRID_GROESSE_X, GRID_GROESSE_Y, grid, how_many_targets, lul);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        for (int i = *x_start; i < *x_start + laenge; i++) {
 | 
				
			||||||
 | 
					            if (*return_code == 1) {
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (i >= GRID_GROESSE_X - laenge/2+1) {
 | 
				
			||||||
 | 
					                *x_start = laenge/2;
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            grid[*y_start][i] = INFILL_X_PIPE;
 | 
				
			||||||
 | 
					            printf("\33[H\033[J");
 | 
				
			||||||
 | 
					            *return_code = print_grid(GRID_GROESSE_X, GRID_GROESSE_Y, grid, how_many_targets, lul);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *x_start += laenge;
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int generate_pipe_y(int GRID_GROESSE_X, int GRID_GROESSE_Y, char **grid, int *x_start, int *y_start, int laenge, int how_many_targets, int *return_code, int *lul) {
 | 
				
			||||||
 | 
					    if (laenge < 0){
 | 
				
			||||||
 | 
					        for (int i = *y_start; i > *y_start + laenge/2; i--) {
 | 
				
			||||||
 | 
					            if (*return_code == 1) {
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (i <= -laenge/2) {
 | 
				
			||||||
 | 
					                *y_start = GRID_GROESSE_Y + laenge/2;
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            grid[i][*x_start] = INFILL_Y_PIPE;
 | 
				
			||||||
 | 
					            printf("\33[H\033[J");
 | 
				
			||||||
 | 
					            *return_code = print_grid(GRID_GROESSE_X, GRID_GROESSE_Y, grid, how_many_targets, lul);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else{
 | 
				
			||||||
 | 
					        for (int i = *y_start; i < *y_start + laenge/2; i++) {
 | 
				
			||||||
 | 
					            if (*return_code == 1) {
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (i >= (GRID_GROESSE_Y / 2)*2 - 1) {
 | 
				
			||||||
 | 
					                *y_start = laenge/2;
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            grid[i][*x_start] = INFILL_Y_PIPE;
 | 
				
			||||||
 | 
					            printf("\33[H\033[J");
 | 
				
			||||||
 | 
					            *return_code = print_grid(GRID_GROESSE_X, GRID_GROESSE_Y, grid, how_many_targets, lul);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    *y_start += laenge/2;
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void generate_target(int GRID_GROESSE_X, int GRID_GROESSE_Y, char **grid, int *x_start, int *y_start, int laenge) {
 | 
				
			||||||
 | 
					    int abstand_vom_rand_x = 6;
 | 
				
			||||||
 | 
					    int abstand_vom_rand_y = 3;
 | 
				
			||||||
 | 
					    int target_x = 0;
 | 
				
			||||||
 | 
					    int target_y = 0;
 | 
				
			||||||
 | 
					    while (target_x <= abstand_vom_rand_x || target_x >= GRID_GROESSE_X - abstand_vom_rand_x || target_y <= abstand_vom_rand_y || target_y >= GRID_GROESSE_Y - abstand_vom_rand_y) {  
 | 
				
			||||||
 | 
					        target_x = ((rand() % GRID_GROESSE_X));
 | 
				
			||||||
 | 
					        target_y = ((rand() % GRID_GROESSE_Y));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (int j = target_y; j < target_y + 2; j++) {
 | 
				
			||||||
 | 
					        for (int i = target_x; i < target_x + 1; i++) {
 | 
				
			||||||
 | 
					                grid[j][i] = 3;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int pipes(int GRID_GROESSE_X, int GRID_GROESSE_Y) {
 | 
				
			||||||
 | 
					//int main() {
 | 
				
			||||||
 | 
					//    system("chcp 65001 >null"); 
 | 
				
			||||||
 | 
					//    int GRID_GROESSE_X = 100;              // x:y -> 2:1 for a square looking grid
 | 
				
			||||||
 | 
					//    int GRID_GROESSE_Y = 60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int x_start = GRID_GROESSE_X / 2;
 | 
				
			||||||
 | 
					    int y_start = GRID_GROESSE_Y / 2;
 | 
				
			||||||
 | 
					    int laenge = 20;
 | 
				
			||||||
 | 
					    int max_l = MAX_LAENGE_PIPE + 1 - MIN_LAENGE_PIPE;
 | 
				
			||||||
 | 
					    int min_l = MIN_LAENGE_PIPE - 1;
 | 
				
			||||||
 | 
					    int color_c_p = COLOR_CHANGING_PROBABILITY + 1;
 | 
				
			||||||
 | 
					    int return_code = 0;
 | 
				
			||||||
 | 
					    int lul = 0;
 | 
				
			||||||
 | 
					    srand(time(NULL));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    random_color();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    char **grid = malloc(GRID_GROESSE_Y * sizeof(char *));
 | 
				
			||||||
 | 
					    for (int i = 0; i < GRID_GROESSE_Y; i++) {
 | 
				
			||||||
 | 
					        grid[i] = malloc(GRID_GROESSE_X * sizeof(char));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < GRID_GROESSE_Y; i++) {
 | 
				
			||||||
 | 
					        for (int j = 0; j < GRID_GROESSE_X; j++) {
 | 
				
			||||||
 | 
					            grid[i][j] = INFILL_PLAIN_PAPER;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    // int richtungswechsler = 1;
 | 
				
			||||||
 | 
					    int how_many_targets = 3;
 | 
				
			||||||
 | 
					    for (int i = 1; i <= how_many_targets; i++) {
 | 
				
			||||||
 | 
					        generate_target(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return_code = generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, 1, how_many_targets, &return_code, &lul);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!DEBUGGER_RANDOM) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        while (!AUTOMATISCH) {
 | 
				
			||||||
 | 
					            if ((rand() %color_c_p) <= 1) {
 | 
				
			||||||
 | 
					                random_color();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            laenge = ((rand() %max_l)+min_l);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					            #ifdef __linux__
 | 
				
			||||||
 | 
					                char key_input = (char)getch_pipes();
 | 
				
			||||||
 | 
					            #elif _WIN32
 | 
				
			||||||
 | 
					                char key_input = (char)getch();
 | 
				
			||||||
 | 
					            #endif
 | 
				
			||||||
 | 
					            switch (key_input) {
 | 
				
			||||||
 | 
					                case 'h': generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'a': generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'l': generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'd': generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'j': generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 's': generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'k': generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'w': generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1, how_many_targets, &return_code, &lul); break;
 | 
				
			||||||
 | 
					                case 'q': return 0;
 | 
				
			||||||
 | 
					                default: continue;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//        while (AUTOMATISCH) {
 | 
				
			||||||
 | 
					//            if ((rand() %color_c_p) <= 1) {
 | 
				
			||||||
 | 
					//                random_color();
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					//            if ((rand() %2)-1) {
 | 
				
			||||||
 | 
					//                laenge = ((rand() %max_l)+min_l);
 | 
				
			||||||
 | 
					//            } else {
 | 
				
			||||||
 | 
					//                laenge = ((rand() %max_l)+min_l)*-1;
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//            if (richtungswechsler == 1) {
 | 
				
			||||||
 | 
					//                generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					//                richtungswechsler *= -1;
 | 
				
			||||||
 | 
					//            } else {
 | 
				
			||||||
 | 
					//                generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					//                richtungswechsler *= -1;
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					//        }
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//    if (DEBUGGER_RANDOM) {
 | 
				
			||||||
 | 
					//        generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -0.1, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1.05, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * -1, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * 0.1, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_y(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge * 0.9, how_many_targets);
 | 
				
			||||||
 | 
					//        generate_pipe_x(GRID_GROESSE_X, GRID_GROESSE_Y, grid, &x_start, &y_start, laenge, how_many_targets);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (int i = 0; i < GRID_GROESSE_Y; i++) {
 | 
				
			||||||
 | 
					        free(grid[i]);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        free(grid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								src/Main-vz/pipes_test.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/Main-vz/pipes_test.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					#ifndef pipes_test_H_
 | 
				
			||||||
 | 
					#define pipes_test_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					// #define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// extern int pipes(int width, int height);
 | 
				
			||||||
 | 
					// int pipes_2(int width, int height);
 | 
				
			||||||
 | 
					int pipes(int GRIG_GROESSE_X, int GRID_GROESSE_Y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										439
									
								
								src/Ramen-vz/Ramen_Physik.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										439
									
								
								src/Ramen-vz/Ramen_Physik.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,439 @@
 | 
				
			|||||||
 | 
					/* Ramen_Physik.c
 | 
				
			||||||
 | 
					Hier werden Physikaufgaben gelöst mit einem Spiel als Pause
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Jana Nieblas, Debora Semmler
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 11.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 11.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Einbindung Bibliotheken
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
					#include <windows.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Einbindung Dateien
 | 
				
			||||||
 | 
					#include "Tic_Tac_Toe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Definitionen
 | 
				
			||||||
 | 
					#define max_anzahl_fehler 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Abfrage Antworten
 | 
				
			||||||
 | 
					int antwort (int loesung, int *falsche_antwort){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while (1)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int eingabe;
 | 
				
			||||||
 | 
					        scanf("%d", &eingabe);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (eingabe == loesung)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            printf("Richtige Antwort \n");
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            printf("Falsche antwort \n");
 | 
				
			||||||
 | 
					            *falsche_antwort += 1;
 | 
				
			||||||
 | 
					           if (*falsche_antwort >= max_anzahl_fehler) {
 | 
				
			||||||
 | 
					                printf("Zu viele ungültige Eingaben. Programm beendet.\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                fflush(stdout);
 | 
				
			||||||
 | 
					                //Sleep
 | 
				
			||||||
 | 
					                #ifdef __linux__
 | 
				
			||||||
 | 
					                    sleep(2);
 | 
				
			||||||
 | 
					                #elif _WIN32
 | 
				
			||||||
 | 
					                    // Sleep ist in Milisekunden
 | 
				
			||||||
 | 
					                    Sleep(2 * 1000);
 | 
				
			||||||
 | 
					                #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return 20;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }    
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Zufällige Ausgabe der Fragen
 | 
				
			||||||
 | 
					int zufaellig(int maximum){
 | 
				
			||||||
 | 
					    int n = rand() % maximum;
 | 
				
			||||||
 | 
					    return n;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//einfache Fragen
 | 
				
			||||||
 | 
					int einfache_fragen(int *falsche_antwort){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Variabeln
 | 
				
			||||||
 | 
					    const int anzahl_fragen = 8;
 | 
				
			||||||
 | 
					    int fragen[3] = {-1, -1,-1};
 | 
				
			||||||
 | 
					    int return_code = 0;
 | 
				
			||||||
 | 
					    int x = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Lösungseingabe
 | 
				
			||||||
 | 
					    printf("Gib '1' ein falls die Aussage wahr ist und '2' falls die Aussage falsch ist. \n \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //abfragen der verwendeten Fragen
 | 
				
			||||||
 | 
					    for (int i = 0; i < 3; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        while (1)      
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            x = zufaellig(anzahl_fragen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (x != fragen[0] && x != fragen[1] && x != fragen[2])
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        fragen[i]=x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Fragen
 | 
				
			||||||
 | 
					        switch (x)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        case 0 :
 | 
				
			||||||
 | 
					            printf("Der relative Fehler ist eine Grösse ohne Masseinheit. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 1 :
 | 
				
			||||||
 | 
					            printf("Es gilt 10^-12 nm = 1 km  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 2 :
 | 
				
			||||||
 | 
					            printf("Die Gewichtskraft eines Objektes steigt linear mit dessen Masse. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 3 :
 | 
				
			||||||
 | 
					            printf("Ein Druck kann sowohl in Flüssigkeiten als auch in Gasen herrschen. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 4 :
 | 
				
			||||||
 | 
					            printf("Der Luftdruck auf Meereshöhe beträgt ca. 10 bar.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 5 :
 | 
				
			||||||
 | 
					            printf("Die barometrische Höhenformel gilt unter der Annahme, dass die Luft in der Atmosphäre überall die gleiche Temperatur hat. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 6 :
 | 
				
			||||||
 | 
					            printf("Es gilt ∆W = mg ∆h, wenn man Reibung und Luftwiderstand vernachlässigt. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 7 :
 | 
				
			||||||
 | 
					            printf("Wird eine Kugel von einer an der Wand befestigten Feder horizontal weggeschleudert wird, dann wird die elastische Energie in kinetische Energie umgewandelt.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (return_code == 20)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return 20;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 10;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//mittlere Fragen
 | 
				
			||||||
 | 
					int mittlere_fragen(int *falsche_antwort){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Variabeln
 | 
				
			||||||
 | 
					    const int anzahl_fragen = 8;
 | 
				
			||||||
 | 
					    int fragen[3] = {-1, -1,-1};
 | 
				
			||||||
 | 
					    int return_code = 0;
 | 
				
			||||||
 | 
					    int x = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Lösungseingabe
 | 
				
			||||||
 | 
					    printf("Gib '1' ein falls die Aussage wahr ist und '2' falls die Aussage falsch ist. \n \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //abfragen verwendeter Fragen
 | 
				
			||||||
 | 
					    for (int i = 0; i < 3; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        while (1)      
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            x = zufaellig(anzahl_fragen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (x != fragen[0] && x != fragen[1] && x != fragen[2])
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        fragen[i]=x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Fragen
 | 
				
			||||||
 | 
					        switch (x)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        case 0 :
 | 
				
			||||||
 | 
					            printf("In der Physik sind weltweit ausschliesslich SI-Einheiten in Gebrauch. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 1 :
 | 
				
			||||||
 | 
					            printf("Das Prinzip actio et reactio ist eine Folge des Impuls-Erhaltungssatzes. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 2 :
 | 
				
			||||||
 | 
					            printf("Befindet sich ein Körper im Stillstand, dann wirkt überhaupt keine Kraft auf ihn. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 3 :
 | 
				
			||||||
 | 
					            printf("Verdoppelt man den Steigungswinkel einer Rampe, dann verdoppelt man auch ihre Steigung.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 4 :
 | 
				
			||||||
 | 
					            printf("Die Ruhepunkt-Methode basiert auf dem Newton-Aktionsprinzip.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 5 :
 | 
				
			||||||
 | 
					            printf("Mit Hilfe der Ruhepunkt-Methode erkennt man, ob die berechneten Kräfte eine Belastung auf Zug oder Druck bedeuten.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 6 :
 | 
				
			||||||
 | 
					            printf("Für jede Bewegung ist die geleistete Arbeit gleich der Fläche im s-F-Diagramm zwischen dem Graphen von F(s) und der s-Achse \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 7 :
 | 
				
			||||||
 | 
					            printf("Die Leistung quantifiziert den Energiestrom, d.h. die übertragene Energie pro Zeiteinheit auf ein Objekt.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (return_code == 20)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return 20;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 10;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//schwere Fragen
 | 
				
			||||||
 | 
					int schwere_fragen(int *falsche_antwort){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Variabeln
 | 
				
			||||||
 | 
					    const int anzahl_fragen = 8;
 | 
				
			||||||
 | 
					    int fragen[3] = {-1, -1,-1};
 | 
				
			||||||
 | 
					    int return_code = 0;
 | 
				
			||||||
 | 
					    int x = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Lösungseingabe
 | 
				
			||||||
 | 
					    printf("Gib '1' ein falls die Aussage wahr ist und '2' falls die Aussage falsch ist. \n \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //abfragen verwendeter Fragen
 | 
				
			||||||
 | 
					    for (int i = 0; i < 3; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        while (1)      
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            x = zufaellig(anzahl_fragen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (x != fragen[0] && x != fragen[1] && x != fragen[2])
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        fragen[i]=x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Fragen
 | 
				
			||||||
 | 
					        switch (x)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        case 0 :
 | 
				
			||||||
 | 
					            printf("Die 7 SI-Basis-Einheiten orientieren sich an den Grössenordnungen der Menschen.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 1 :
 | 
				
			||||||
 | 
					            printf("Die Ursache des Impuls-Erhaltungssatzes ist die Zeitunabhängigkeit der physikalischen Gesetze.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 2 :
 | 
				
			||||||
 | 
					            printf("Der Begriff Kraft quantifiziert den Impulsstrom, d.h. den Impulsübertrag pro Zeiteinheit auf ein Objekt.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 3 :
 | 
				
			||||||
 | 
					            printf("Wirkt auf ein fahrendes Auto nur der turbulente Strömungswiderstand, dann wird es gleichförmig abgebremst. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 4 :
 | 
				
			||||||
 | 
					            printf("Die Leistung eines Blitzschlages kann die Leistung eines Grosskraftwerkes weit übertreffen.  \n");
 | 
				
			||||||
 | 
					            return_code = antwort(1, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 5 :
 | 
				
			||||||
 | 
					            printf("Wird ein Körper von der Geschwindigkeit v0 < 0 mit konstanter Leistung P auf eine Geschwindigkeit vE < v0 beschleunigt, dann gilt P < 0. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 6 :
 | 
				
			||||||
 | 
					            printf("Ist die Beschleunigungsfunktion eines Objektes strikt negativ, d.h. gilt a(t) < 0 zu jeder Zeit t ≥ t0, dann bewegt sich das Objekt zu jeder Zeit t ≥ t0 in Rückwärtsrichtung (negative Bewegungsrichtung). \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 7 :
 | 
				
			||||||
 | 
					            printf("Es seien ∆t = tE - t0, ∆s = sE - s0 und ∆v = vE - v0. Dann gilt für jede Bewegung v(t) = ∆s/∆t und a(t) = ∆v/∆t. \n");
 | 
				
			||||||
 | 
					            return_code = antwort(2, falsche_antwort);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (return_code == 20)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return 20;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 10;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Hauptunktionen                                                            
 | 
				
			||||||
 | 
					int Ramen_Physik(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Umlaute
 | 
				
			||||||
 | 
					    system("chcp 65001 >null");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Zufallsgenerator initialisieren
 | 
				
			||||||
 | 
					    srand(time(NULL));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Variabeln
 | 
				
			||||||
 | 
					    char eingabe = '0';
 | 
				
			||||||
 | 
					    int return_code = 0;
 | 
				
			||||||
 | 
					    int falsche_antwort = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while (1){
 | 
				
			||||||
 | 
					        //löschen der Konsole
 | 
				
			||||||
 | 
					        printf("\e[1;1H\e[2J");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Auswahl der Schwierigkeitsstufe
 | 
				
			||||||
 | 
					        printf("1 \t einfache Fragen \n");
 | 
				
			||||||
 | 
					        printf("2 \t mittlere Fragen \n");
 | 
				
			||||||
 | 
					        printf("3 \t schwere Fragen \n");
 | 
				
			||||||
 | 
					        printf("q \t zurück zum Hauptmenu \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        scanf("%c", &eingabe);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Abfrage der Eingabe
 | 
				
			||||||
 | 
					        switch (eingabe){
 | 
				
			||||||
 | 
					            case '1':{
 | 
				
			||||||
 | 
					                printf("\neinfache Fragen\n");
 | 
				
			||||||
 | 
					                return_code = einfache_fragen(&falsche_antwort);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case '2':{
 | 
				
			||||||
 | 
					                printf("\nmittlere Fragen\n");
 | 
				
			||||||
 | 
					                return_code = mittlere_fragen(&falsche_antwort);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case '3':{
 | 
				
			||||||
 | 
					                printf("\nschwere Fragen\n");
 | 
				
			||||||
 | 
					                return_code = schwere_fragen(&falsche_antwort);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case '4':{
 | 
				
			||||||
 | 
					                Tic_Tac_Toe();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                fflush(stdout);
 | 
				
			||||||
 | 
					                //Sleep
 | 
				
			||||||
 | 
					                #ifdef __linux__
 | 
				
			||||||
 | 
					                    sleep(2);
 | 
				
			||||||
 | 
					                #elif _WIN32
 | 
				
			||||||
 | 
					                // Sleep ist in Milisekunden
 | 
				
			||||||
 | 
					                    Sleep(2 * 1000);
 | 
				
			||||||
 | 
					                #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            case 'q':{
 | 
				
			||||||
 | 
					                printf("\nProgramm beendet \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                fflush(stdout);
 | 
				
			||||||
 | 
					                //Sleep
 | 
				
			||||||
 | 
					                #ifdef __linux__
 | 
				
			||||||
 | 
					                    sleep(2);
 | 
				
			||||||
 | 
					                #elif _WIN32
 | 
				
			||||||
 | 
					                // Sleep ist in Milisekunden
 | 
				
			||||||
 | 
					                    Sleep(2 * 1000);
 | 
				
			||||||
 | 
					                #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return 10;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            case '\n':{
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            default: {
 | 
				
			||||||
 | 
					                printf("Zu viele ungültige Eingaben. Programm beendet.\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                fflush(stdout);
 | 
				
			||||||
 | 
					                //Sleep
 | 
				
			||||||
 | 
					                #ifdef __linux__
 | 
				
			||||||
 | 
					                    sleep(2);
 | 
				
			||||||
 | 
					                #elif _WIN32
 | 
				
			||||||
 | 
					                    // Sleep ist in Milisekunden
 | 
				
			||||||
 | 
					                    Sleep(2 * 1000);
 | 
				
			||||||
 | 
					                #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return 20;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        switch (return_code){
 | 
				
			||||||
 | 
					          case 10: { 
 | 
				
			||||||
 | 
					            Tic_Tac_Toe(); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            fflush(stdout);
 | 
				
			||||||
 | 
					            //Sleep
 | 
				
			||||||
 | 
					            #ifdef __linux__
 | 
				
			||||||
 | 
					                sleep(2);
 | 
				
			||||||
 | 
					            #elif _WIN32
 | 
				
			||||||
 | 
					                // Sleep ist in Milisekunden
 | 
				
			||||||
 | 
					                Sleep(2 * 1000);
 | 
				
			||||||
 | 
					            #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return_code = 0; 
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          case 20: return 20; break; 
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								src/Ramen-vz/Ramen_Physik.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/Ramen-vz/Ramen_Physik.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					/* Ramen_Physik.h
 | 
				
			||||||
 | 
					Hier werden Physikaufgaben gelöst mit einem Spiel als Pause
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Jana Nieblas
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 15.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 15.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					#define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   //extern Phxsik mit Spiel; 
 | 
				
			||||||
 | 
					   extern int Ramen_Physik();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										187
									
								
								src/Ramen-vz/Tic_Tac_Toe.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								src/Ramen-vz/Tic_Tac_Toe.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,187 @@
 | 
				
			|||||||
 | 
					/* Tic Tac Toe
 | 
				
			||||||
 | 
					Ein einfaches Tic Tac Toe programm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Debora Semmler
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version: 1.0
 | 
				
			||||||
 | 
					Datum: 13.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 13.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Einbinden von Headerdateien der Programmbibliothek.
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Definition von Spielfeld und Symbolen
 | 
				
			||||||
 | 
					char board[3][3];
 | 
				
			||||||
 | 
					const char PLAYER = 'O';
 | 
				
			||||||
 | 
					const char COMPUTER = 'X';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Funktionsprototypen
 | 
				
			||||||
 | 
					void resetBoard();
 | 
				
			||||||
 | 
					void printBoard();
 | 
				
			||||||
 | 
					int checkFreeSpaces();
 | 
				
			||||||
 | 
					void playerMoves();
 | 
				
			||||||
 | 
					void computerMoves();
 | 
				
			||||||
 | 
					char checkWinner();
 | 
				
			||||||
 | 
					void printWinner(char);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Das Hauptprogramm
 | 
				
			||||||
 | 
					int Tic_Tac_Toe() 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						printf("Du spielst mit O und der Computer mit X \n \n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char winner = ' ';
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						resetBoard();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while(winner == ' ' && checkFreeSpaces() != 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							printBoard();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							playerMoves();
 | 
				
			||||||
 | 
							winner = checkWinner();
 | 
				
			||||||
 | 
							if(winner != ' ' || checkFreeSpaces() == 0){
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							computerMoves();
 | 
				
			||||||
 | 
							winner = checkWinner();
 | 
				
			||||||
 | 
							if(winner != ' ' || checkFreeSpaces() == 0){
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						printBoard();
 | 
				
			||||||
 | 
						printWinner(winner);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// Rückgabewert, dass das Programm erfolgreich beendet wurde.
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void resetBoard(){
 | 
				
			||||||
 | 
						for(int i = 0; i<3; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for(int j = 0; j<3; j++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								board[i][j]	= ' ';
 | 
				
			||||||
 | 
							}	
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Gibt das Spielfeld aus
 | 
				
			||||||
 | 
					void printBoard(){
 | 
				
			||||||
 | 
						printf("[ %c ][ %c ][ %c ]\n", board[0][0], board[0][1], board[0][2]);
 | 
				
			||||||
 | 
						printf("[ %c ][ %c ][ %c ]\n", board[1][0], board[1][1], board[1][2]);
 | 
				
			||||||
 | 
						printf("[ %c ][ %c ][ %c ]\n", board[2][0], board[2][1], board[2][2]);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Zählt die freien Felder auf dem Spielfeld
 | 
				
			||||||
 | 
					int checkFreeSpaces(){
 | 
				
			||||||
 | 
						int freeSpaces = 9;	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int i = 0; i<3; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for(int j = 0; j<3; j++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if(board[i][j] != ' ')
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									freeSpaces--;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return freeSpaces;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Ernöglicht dem Spieler einen Zug zu machen
 | 
				
			||||||
 | 
					void playerMoves(){
 | 
				
			||||||
 | 
						int x;
 | 
				
			||||||
 | 
						int y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						do
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							printf("Gibt die Horizontale ein (1-3): ");
 | 
				
			||||||
 | 
							scanf("%d", &x);
 | 
				
			||||||
 | 
							x--;
 | 
				
			||||||
 | 
							printf("Gib die Vertikale ein (1-3): ");
 | 
				
			||||||
 | 
							scanf("%d", &y);
 | 
				
			||||||
 | 
							y--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(board[x][y] != ' ')
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								printf("Ungültig!\n");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else{
 | 
				
			||||||
 | 
								board[x][y] = PLAYER;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						} while (board[x][y] != ' ');
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Der Computer macht einen Zufallszug
 | 
				
			||||||
 | 
					void computerMoves(){
 | 
				
			||||||
 | 
						//Seed für Zufallszahlen
 | 
				
			||||||
 | 
						srand(time(0));
 | 
				
			||||||
 | 
						int x;
 | 
				
			||||||
 | 
						int y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(checkFreeSpaces() > 0){
 | 
				
			||||||
 | 
							do
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								x = rand() % 3;
 | 
				
			||||||
 | 
								y = rand() % 3;
 | 
				
			||||||
 | 
							} while (board[x][y] != ' ');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							board[x][y] = COMPUTER;	
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else{
 | 
				
			||||||
 | 
							printWinner(' ');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Überprüft die Gewinn bedingungen
 | 
				
			||||||
 | 
					char checkWinner(){
 | 
				
			||||||
 | 
						//Prüft nach horizontalen Gewinnbedingungen
 | 
				
			||||||
 | 
						for(int i = 0; i < 3; i ++){
 | 
				
			||||||
 | 
							if(board[i][0] == board[i][1] && board[i][0] == board[i][2]){
 | 
				
			||||||
 | 
								return board[i][0]; 
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						//Prüft nach vertikalen Gewinnbedingungen
 | 
				
			||||||
 | 
						for(int i = 0; i < 3; i ++){
 | 
				
			||||||
 | 
							if(board[0][i] == board[1][i] && board[0][i] == board[2][i]){
 | 
				
			||||||
 | 
								return board[0][i]; 
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						//Prüft nach diagonalen Gewinnbedingungen
 | 
				
			||||||
 | 
						if(board[0][0] == board[1][1] && board[0][0] == board[2][2]){
 | 
				
			||||||
 | 
							return board[0][0]; 
 | 
				
			||||||
 | 
						}	
 | 
				
			||||||
 | 
						if(board[0][2] == board[1][1] && board[0][2] == board[2][0]){
 | 
				
			||||||
 | 
							return board[0][2]; 
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return ' ';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Gibt das Ergebnis des Spieldurchgangs aus
 | 
				
			||||||
 | 
					void printWinner(char winner){
 | 
				
			||||||
 | 
						if(winner == PLAYER){
 | 
				
			||||||
 | 
							printf("DU HAST GEWONNEN!");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if(winner == COMPUTER){
 | 
				
			||||||
 | 
							printf("DU HAST VERLOREN!");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else{
 | 
				
			||||||
 | 
							printf("ES IST EIN UNENTSCHIEDEN!");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										18
									
								
								src/Ramen-vz/Tic_Tac_Toe.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/Ramen-vz/Tic_Tac_Toe.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					/* Ramen_Physik.h
 | 
				
			||||||
 | 
					Hier wir das Spiel als Pause verknüpft
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Jana Nieblas
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 15.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 15.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					#define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   //extern Spiel; 
 | 
				
			||||||
 | 
					   extern int Tic_Tac_Toe();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										351
									
								
								src/Wein-tz/Abbildungsrechner.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										351
									
								
								src/Wein-tz/Abbildungsrechner.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,351 @@
 | 
				
			|||||||
 | 
					/* Abbildungsrechner.c
 | 
				
			||||||
 | 
					Disese Programm macht folgendes: 
 | 
				
			||||||
 | 
					1. Wahl zur Berechnung von optischen Messgroessen
 | 
				
			||||||
 | 
					2. Berechnung der gewaehlte Messgroesse
 | 
				
			||||||
 | 
					3. Gibt die Berechnung auf der Konsole aus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Catherine, Mika und Sebastian
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 14.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 14.12.2024 Erste Version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
					 ** Eingebundene Bibliotheken			                                     **
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
					 ** Variablen                                                                **
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					float f, a, A, M, y, Y; //Brennweite, Objektweite, Bildweite, Vergroesserung, Objektgroesse, Bildgroesse
 | 
				
			||||||
 | 
					int P = 0; //Programmauswahl 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
					 ** Funktions Prototypen                                                     **
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					void programmAuswahl();
 | 
				
			||||||
 | 
					void Berechnung_Optische_Abbildung(float f, float a, float A, float M, float y, float Y, int P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
					 ** Hauptfunktion                                                            **
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					int Abbildungsrechner()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    while (P != 10){
 | 
				
			||||||
 | 
					    programmAuswahl();
 | 
				
			||||||
 | 
					    Berechnung_Optische_Abbildung(f, a, A, M, y, Y, P); 
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    P = 0;
 | 
				
			||||||
 | 
					    return 10;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					/******************************************************************************
 | 
				
			||||||
 | 
					 ** Funktionen                                                               **
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					void programmAuswahl()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    printf("Waehlen Sie die zu berechnende Groesse: \n");
 | 
				
			||||||
 | 
					    printf("1: Brennweite (f)\n");
 | 
				
			||||||
 | 
					    printf("2: Objektweite (a)\n");
 | 
				
			||||||
 | 
					    printf("3: Bildweite (A)\n");
 | 
				
			||||||
 | 
					    printf("4: Objektgroesse (y)\n");
 | 
				
			||||||
 | 
					    printf("5: Bildgroesse (Y)\n");
 | 
				
			||||||
 | 
					    printf("6: Vergroesserung (M)\n");
 | 
				
			||||||
 | 
					    printf("q: zurück zum Menu\n");
 | 
				
			||||||
 | 
					    printf("Geben sie Ihre P ein(1-6):\n ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    char auswahl[21] = {0};
 | 
				
			||||||
 | 
					    long auswahl_int = 0;
 | 
				
			||||||
 | 
					    char *endptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    scanf("%20s", auswahl);
 | 
				
			||||||
 | 
					    auswahl_int = strtol((const char*)auswahl, &endptr, 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (*endptr != 0){
 | 
				
			||||||
 | 
					        auswahl_int = -1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (*endptr == 'q'){
 | 
				
			||||||
 | 
					        P = 10;
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    P = auswahl_int;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch(P)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        case 1:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 1 gewaehlt: Brennweite berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 2:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 2 gewaehlt: Objektweite berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 3:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 3 gewaehlt: Bildweite berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 4:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 4 gewaehlt: Objektgroesse berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 5:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 5 gewaehlt: Bildgroesse berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 6:
 | 
				
			||||||
 | 
					        printf("Sie haben Programm 6 gewaehlt: Vergroesserung berechnen\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					        printf("Dieses Programm ist ungueltigt.\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					void Berechnung_Optische_Abbildung(float f, float a, float A, float M, float y, float Y, int P)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    switch (P) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 1:     // Berechnung Brennweite [f]
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildweite [A] und Objektweite [a] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &A);
 | 
				
			||||||
 | 
					        printf("Objektweite [a]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Brennweite mit Objektweite [a] und Bildweite [A]
 | 
				
			||||||
 | 
					        f = (a * A) / (A + a);
 | 
				
			||||||
 | 
					        // Berechnung Vergroesserung mit Objektweite (a) und Bildweite [A]
 | 
				
			||||||
 | 
					        M = -(A / a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Brennweite [f]:\n%f", f);
 | 
				
			||||||
 | 
					        printf("\nVergroesserung [M]:\n%f", M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("f = (a * A) / (A + a)\n");
 | 
				
			||||||
 | 
					        printf("M = (A / a)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 2:     // Berechnung Objektweite [a]
 | 
				
			||||||
 | 
					        printf("Waehlen Sie die Berechnungsmethode:\n");
 | 
				
			||||||
 | 
					        printf("1: Mit Bildweite [A] und Brennweite [f]\n");
 | 
				
			||||||
 | 
					        printf("2: Mit Bildgroesse [Y] und Objektgroesse [y]\n");
 | 
				
			||||||
 | 
					        scanf("%d", &P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (P == 1) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildweite [A] und Brennweite [f] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &A );
 | 
				
			||||||
 | 
					        printf("Brennweite [f]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Objektweite [a] mit Bildweite [A] und Brennweite [f]
 | 
				
			||||||
 | 
					        a = (f * A) / (A - f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Objektweite [a]:\n%f", a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("a = (f * A) / (A - f)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (P == 2) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildgroesse [Y] und Objektgroesse [y] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildgroesse [Y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &Y);
 | 
				
			||||||
 | 
					        printf("Objektgroesse [y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Objektweite [a] mit Bildweite [A] und Vergroesserung (M) 
 | 
				
			||||||
 | 
					        a = -(A / M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Objektweite [a]:\n%f", a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("a = a(A / M)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 3:     // Berechnung Bildweite [A]
 | 
				
			||||||
 | 
					        printf("Waehlen Sie die Berechnungsmethode:\n");
 | 
				
			||||||
 | 
					        printf("1: Mit Objektweite [a] und Brennweite [f]\n");
 | 
				
			||||||
 | 
					        printf("2: Mit Objektweite [a] und Vergroesserung [M]\n");
 | 
				
			||||||
 | 
					        scanf("%d", &P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (P == 1) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Objektweite [a] und Brennweite [f] ein:\n");
 | 
				
			||||||
 | 
					        printf("Objektweite [a]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &a);
 | 
				
			||||||
 | 
					        printf("Brennweite [f]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Bildweite [A] mit Brennweite [f] und Objektweite [a]
 | 
				
			||||||
 | 
					        A = (f * a) / (a - f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]:\n%f", A);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("A = (f * a) / (a - f)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        } 
 | 
				
			||||||
 | 
					        else if (P == 2) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Vergroesserung [M] und Objektweite [a] ein:\n");
 | 
				
			||||||
 | 
					        printf("Vergroesserung [M]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &M);
 | 
				
			||||||
 | 
					        printf("Objektweite [a]");
 | 
				
			||||||
 | 
					        scanf("%f", &a);  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Bildweite [A] mit Vergroesserung [M] und Objektweite [a]
 | 
				
			||||||
 | 
					        A = -(a * M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]:\n%f", A);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("A = -(a * M)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 4:     // Berechnung Objektgroesse [y]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("Waehlen Sie die Berechnungsmethode:\n");
 | 
				
			||||||
 | 
					        printf("1: Mit Bildweite [A], Objektweite [a] und Bildgroesse [y]\n");
 | 
				
			||||||
 | 
					        printf("2: Mit Bildgroesse [Y] und Vergroesserung [M]\n");
 | 
				
			||||||
 | 
					        scanf("%d", &P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (P == 1) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildweite [A] und Objektweite [a] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &A);
 | 
				
			||||||
 | 
					        printf("Objektweite [a]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &a); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Objektgroesse [y] mit Bildweite [A] und Objektweite [a] und Bildgroesse [y]
 | 
				
			||||||
 | 
					        y = -(Y * A) / a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Objektgroesse [y]:\n%f", y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("a = -(Y * A) / a\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        else if (P == 2) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildgroesse [Y] und Vergroesserung [M] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildgroesse [Y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &Y);
 | 
				
			||||||
 | 
					        printf("Vergroesserung[M]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Objektgroesse [y] mit Bildgroesse [Y] und Vergroesserung [M]
 | 
				
			||||||
 | 
					        y = Y / M;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Objektgroesse [y]:\n%f", y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("y = Y / M\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 5:     // Berechnung Bildgroesse [Y]
 | 
				
			||||||
 | 
					        printf("Waehlen Sie die Berechnungsmethode:\n");
 | 
				
			||||||
 | 
					        printf("1: Mit Bildweite [A], Objektweite [a] und Objektgroesse [y]\n");
 | 
				
			||||||
 | 
					        printf("2: Mit Bildgroesse [Y] und Vergroesserung [M]\n");
 | 
				
			||||||
 | 
					        scanf("%d", &P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (P == 1) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildweite [A], Objektweite [a] und Objektgroesse [y] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &A);
 | 
				
			||||||
 | 
					        printf("Objektweite [a]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &a);
 | 
				
			||||||
 | 
					        printf("Objektgroesse [y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &y); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Bildgroesse [Y] mit Objektweite [a] und Bildweite [A] und Objektgroesse [y]
 | 
				
			||||||
 | 
					        Y = -(A / a) * y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Bildgroesse [Y]:\n%f", Y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("\nY = -(A / a) * y\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        } 
 | 
				
			||||||
 | 
					        else if (P == 2) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildgroesse [Y] und Vergroesserung [M] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildgroesse [Y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &Y);
 | 
				
			||||||
 | 
					        printf("Vergroesserung [M]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Bildgroesse [Y] mit Vergroesserung [M] und Objektgroesse [y]
 | 
				
			||||||
 | 
					        Y = y * M;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Bildgroesse [Y]:\n%f", Y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Y = y * M\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        case 6:     // Berechnung Vergroesserung [M]
 | 
				
			||||||
 | 
					        printf("Waehlen Sie die Berechnungsmethode:\n");
 | 
				
			||||||
 | 
					        printf("1: Mit Bildweite [A] und Objektweite [a]\n");
 | 
				
			||||||
 | 
					        printf("2: Mit Bildgroesse [Y] und Objektgroesse [y]\n");
 | 
				
			||||||
 | 
					        scanf("%d", &P);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (P == 1) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildweite [A] und Objektweite [a] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildweite [A]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &A);
 | 
				
			||||||
 | 
					        printf("Objektweite [a]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Vergroesserung [M] mit Objektweite [a] und Bildweite [A]
 | 
				
			||||||
 | 
					        M = -(A / a);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Vergroesserung [M]\n%f", M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("M = -(A / a)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        else if (P == 2) {
 | 
				
			||||||
 | 
					        printf("Geben Sie Bildgroesse [Y] und Objektgroesse [y] ein:\n");
 | 
				
			||||||
 | 
					        printf("Bildgroeße [Y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &Y);
 | 
				
			||||||
 | 
					        printf("Objektgroesse [y]: ");
 | 
				
			||||||
 | 
					        scanf("%f", &y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Berechnung Vergroesserung [M] mit Objektgroesse [y] und Bildgroesse [Y]
 | 
				
			||||||
 | 
					        M = (Y / y); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        printf("Vergroesserung [M]\n%f", M);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf("\n-----------------------\n");
 | 
				
			||||||
 | 
					        printf("M = (Y /y)\n");
 | 
				
			||||||
 | 
					        printf("-----------------------\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/Wein-tz/Abbildungsrechner.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/Wein-tz/Abbildungsrechner.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					/* Abbildungsrechner.h
 | 
				
			||||||
 | 
					Dies ist die Verknüpfung zum Abbildungsrechner
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Autor: Catherine, Sebastian, Mika
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version 1.0
 | 
				
			||||||
 | 
					Datum 16.12.2024
 | 
				
			||||||
 | 
					Aenderungen:
 | 
				
			||||||
 | 
					V 1.0 16.12.2024 Erste Version
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _Abbildungsrechner_H_ 
 | 
				
			||||||
 | 
					#define _Abbildungsrechner_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int Abbildungsrechner();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										17
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.c
									
									
									
									
									
								
							@ -24,19 +24,21 @@ Datum: 04.12.2024
 | 
				
			|||||||
    #include <sys/ioctl.h>
 | 
					    #include <sys/ioctl.h>
 | 
				
			||||||
    #include <unistd.h>
 | 
					    #include <unistd.h>
 | 
				
			||||||
    #include <termio.h>
 | 
					    #include <termio.h>
 | 
				
			||||||
    #include "kbhit_linux.h"
 | 
					    #include "Main-vz/kbhit_linux.h"
 | 
				
			||||||
#elif _WIN32
 | 
					#elif _WIN32
 | 
				
			||||||
    #include <windows.h>
 | 
					    #include <windows.h>
 | 
				
			||||||
    #include <conio.h>
 | 
					    #include <conio.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import sub programme
 | 
					// import sub programme
 | 
				
			||||||
#include "Ramen_Physik.h"
 | 
					#include "Ramen-vz/Ramen_Physik.h"
 | 
				
			||||||
#include "Fehlenden_Elektronik.h"
 | 
					#include "Fehlenden-vz/Fehlenden_Elektronik.h"
 | 
				
			||||||
 | 
					#include "Wein-tz/Abbildungsrechner.h"
 | 
				
			||||||
#include "test_prog.h"
 | 
					#include "test_prog.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "pipes_test.h"
 | 
					#include "Main-vz/pipes_test.h"
 | 
				
			||||||
#include "pipes2.h"
 | 
					#include "Main-vz/pipes2.h"
 | 
				
			||||||
 | 
					#include "Main-vz/pipes2_game.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __linux__
 | 
					#ifdef __linux__
 | 
				
			||||||
@ -182,7 +184,7 @@ void print_menu(int terminal_width, int terminal_height, int line){
 | 
				
			|||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (0 <= line && line < 2) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (0 <= line && line < 2) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  2 Fehlenden Elektronik               ┃", spaces, (1 <= line && line < 2) ? ";31": ";37");
 | 
					        print_line("┃  2 Fehlenden Elektronik               ┃", spaces, (1 <= line && line < 2) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  3 Programm                           ┃", spaces, (2 <= line && line < 3) ? ";31": ";37");
 | 
					        print_line("┃  3 Abbildungsrechner                  ┃", spaces, (2 <= line && line < 3) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  4 Programm                           ┃", spaces, (3 <= line && line < 4) ? ";31": ";37");
 | 
					        print_line("┃  4 Programm                           ┃", spaces, (3 <= line && line < 4) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37");
 | 
				
			||||||
@ -241,7 +243,7 @@ void run_programm(int programm, int width, int height, bool *used){
 | 
				
			|||||||
    switch (programm) {
 | 
					    switch (programm) {
 | 
				
			||||||
        case 0: return_code = Ramen_Physik(); break;
 | 
					        case 0: return_code = Ramen_Physik(); break;
 | 
				
			||||||
        case 1: return_code = Fehlenden_Elektronik_main(); break;
 | 
					        case 1: return_code = Fehlenden_Elektronik_main(); break;
 | 
				
			||||||
        case 2: return_code = test_gruppe_programmname(); break;
 | 
					        case 2: return_code = Abbildungsrechner(); break;
 | 
				
			||||||
        case 3: return_code = test_gruppe_programmname(); break;
 | 
					        case 3: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
        case 4: return_code = test_gruppe_programmname(); break;
 | 
					        case 4: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
        case 5: return_code = test_gruppe_programmname(); break;
 | 
					        case 5: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
@ -360,6 +362,7 @@ int main(int argc, char **argv){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            case 'p': pipes(width, height); break;
 | 
					            case 'p': pipes(width, height); break;
 | 
				
			||||||
            case 'P': pipes_2(width, height); break;
 | 
					            case 'P': pipes_2(width, height); break;
 | 
				
			||||||
 | 
					            case 'o': pipes_2_game(width, height); break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // windows
 | 
					            // windows
 | 
				
			||||||
            case -32:{
 | 
					            case -32:{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user