Compare commits
25 Commits
5a039bd152
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f50cee48b | |||
| 42b3b2891c | |||
| c3a717ccbe | |||
| 0cd4403cc2 | |||
| 4cae4e9e28 | |||
| 5c211013b5 | |||
| cdba13032a | |||
| c0cf1f4177 | |||
| 9844efeaad | |||
| 20c1401458 | |||
| 774c355b45 | |||
| 3954d3b1bf | |||
| 24cffc3c6c | |||
| 6eca31ddc7 | |||
| b8fc2b7ccb | |||
| 084b66fe0e | |||
| 5d1ec4f974 | |||
| 1c3f79605b | |||
| 9a1615c1ea | |||
| 483d40da91 | |||
| e69dd43fea | |||
| 20099ae740 | |||
| 489ca42d32 | |||
| 243bed60eb | |||
| 844800b963 |
2
.idea/libraries/openjfx_javafx_base.xml
generated
@@ -3,7 +3,7 @@
|
||||
<properties maven-id="org.openjfx:javafx-base:20-ea+2" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2-linux.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2-win-x86-monocle.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
2
.idea/vcs.xml
generated
@@ -2,5 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/WS24_25/SWTD/BuchRedesign" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/WS24_25/SWTD/buchv1" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 14)
|
||||
include_directories(WS23_24/Anwendungsentwicklung/src/P11)
|
||||
|
||||
add_executable(FH
|
||||
WS23_24/Anwendungsentwicklung/src/P11/date.c)
|
||||
WS23_24/Anwendungsentwicklung/src/P11/test.c)
|
||||
|
||||
1
FH.iml
@@ -5,6 +5,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/WS22_23/BP" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/WS22_23/EidP" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/WS24_25/SWTD/BuchRedesign/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/CMakeFiles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/CMakeFiles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/CMakeFiles" />
|
||||
|
||||
8
WS23_24/Anwendungsentwicklung/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
1
WS23_24/Anwendungsentwicklung/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
FH
|
||||
2
WS23_24/Anwendungsentwicklung/.idea/Anwendungsentwicklung.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
6
WS23_24/Anwendungsentwicklung/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$/../..">
|
||||
<contentRoot DIR="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
||||
8
WS23_24/Anwendungsentwicklung/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Anwendungsentwicklung.iml" filepath="$PROJECT_DIR$/.idea/Anwendungsentwicklung.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
WS23_24/Anwendungsentwicklung/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -11,5 +11,6 @@
|
||||
<orderEntry type="library" name="openjfx.javafx.graphics" level="project" />
|
||||
<orderEntry type="library" name="openjfx.javafx.controls" level="project" />
|
||||
<orderEntry type="library" name="scala-sdk-2.13.12" level="application" />
|
||||
<orderEntry type="library" name="scala-sdk-2.13.12" level="application" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -2,13 +2,16 @@ package Klausur_ueb
|
||||
|
||||
object Lambda {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val a = Array(1, 2, 3, 4, 5)
|
||||
val summe = a.reduce((x: Int, y: Int) => x + y)
|
||||
val a = Array(1.0, 2.0, 3.0, 4.0, 5.0)
|
||||
val summe = a.reduce((x: Double, y: Double) => x + y)
|
||||
val summeKuerzer = a.reduce((x, y) => x + y)
|
||||
val summeNochKuerzer = a.reduce(_ * _)
|
||||
val prodNochKuerzer = a.reduce(_ * _)
|
||||
val qNochKuerzer = a.reduce(_ / _)
|
||||
val summeGanzKurz = a.sum //vordefiniert
|
||||
println(summeGanzKurz)
|
||||
println(summeNochKuerzer)
|
||||
println(prodNochKuerzer)
|
||||
println(qNochKuerzer)
|
||||
println(1.0/120.0)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package Klausur_ueb;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
@@ -15,10 +13,11 @@ public class StreamsTraining {
|
||||
public static void main(String[] args) {
|
||||
//startFib();
|
||||
//directFib();
|
||||
directFib2();
|
||||
//lorem();
|
||||
//System.out.println(fak(25));
|
||||
//System.out.println(fak(15));
|
||||
lorem2();
|
||||
//lorem2();
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +39,24 @@ public class StreamsTraining {
|
||||
.map(s->s[0])//only take s[0]
|
||||
.forEach(System.out::println);
|
||||
}
|
||||
static void directFib2(){
|
||||
IntStream.rangeClosed(0, 10)
|
||||
.mapToObj(StreamsTraining::fibonacciiii)
|
||||
.forEach(System.out::println);
|
||||
}
|
||||
public static int fibonacciiii(int n) {
|
||||
if (n <= 1)
|
||||
return n;
|
||||
|
||||
int prev = 0;
|
||||
int curr = 1;
|
||||
for (int i = 2; i <= n; i++) {
|
||||
int next = prev + curr;
|
||||
prev = curr;
|
||||
curr = next;
|
||||
}
|
||||
return curr;
|
||||
}
|
||||
|
||||
static void lorem(){
|
||||
String lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
|
||||
|
||||
12
WS23_24/Anwendungsentwicklung/src/P10/Curry.scala
Normal file
@@ -0,0 +1,12 @@
|
||||
package P10
|
||||
|
||||
object Curry {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val curriedSum: Double => Double => Double => Double => Double = a => b => c => d => a+b+c+d
|
||||
def currieSum2(a:Int)(b:Int): Int => Int => Int = (x:Int)=>(y:Int) => a+b+x+y
|
||||
val curFunc = curriedSum(1)(2)
|
||||
val curFunc2 = currieSum2(1)(2)
|
||||
println(curFunc(3)(4))
|
||||
println(curFunc2(3)(4))
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,72 @@ import scala.annotation.tailrec
|
||||
|
||||
object FrenchDude {
|
||||
def main(args: Array[String]): Unit = {
|
||||
|
||||
startPascal(5)
|
||||
println(" ")
|
||||
startPascal2(5)
|
||||
println(" ")
|
||||
fib(5)
|
||||
}
|
||||
def pascalTriangle(c: Int, r: Int): Int = {
|
||||
|
||||
def startPascal(n:Int):Unit={
|
||||
pascal(Array(1),n)
|
||||
}
|
||||
def startPascal2(n:Int):Unit={
|
||||
pascal2(Array(1),n)
|
||||
}
|
||||
|
||||
//Endrekursiv
|
||||
@tailrec
|
||||
def loop(c0: Int, r0: Int, pred: Array[Int], cur: Array[Int]): Int = {
|
||||
cur(c0) = (if (c0 > 0) pred(c0 - 1) else 0) + (if (c0 < r0) pred(c0) else 0)
|
||||
|
||||
if ((c0 == c) && (r0 == r)) cur(c0)
|
||||
else if (c0 < r0) loop(c0 + 1, r0, pred, cur)
|
||||
else loop(0, r0 + 1, cur, new Array(_length = r0 + 2))
|
||||
def pascal (arr:Array[Int],n:Int): Unit = {
|
||||
arr.foreach(v => print(v+" "))
|
||||
var newArr = Array[Int]()
|
||||
newArr = newArr :+ 1
|
||||
for (i <- arr.indices){
|
||||
if (i<arr.length-1)
|
||||
newArr = newArr:+ arr(i)+arr(i+1)
|
||||
}
|
||||
newArr = newArr :+ 1
|
||||
println()
|
||||
if(newArr.length <= n+1)
|
||||
pascal(newArr,n)
|
||||
}
|
||||
|
||||
if ((c == 0) && (r == 0)) 1
|
||||
else loop(0, 1, Array(1), Array(0, 0))
|
||||
//Rekursiv, aber nicht Endrekursiv
|
||||
def pascal2 (arr:Array[Int],n:Int): Unit = {
|
||||
arr.foreach(v => print(v+" "))
|
||||
var newArr = Array[Int]()
|
||||
newArr = newArr :+ 1
|
||||
for (i <- arr.indices){
|
||||
if (i<arr.length-1)
|
||||
newArr = newArr:+ arr(i)+arr(i+1)
|
||||
}
|
||||
newArr = newArr :+ 1
|
||||
println()
|
||||
if(newArr.length <= n+1)
|
||||
pascal2(newArr,n)
|
||||
println()
|
||||
}
|
||||
|
||||
def fib(n: Int): Unit = {
|
||||
def fibIn(x: Int, previous: Array[Int], current: Array[Int]): Unit = {
|
||||
def topOffset(off: Int): Int = {
|
||||
val newX = x + off
|
||||
if (newX >= 0 && newX < previous.length)
|
||||
previous(newX)
|
||||
else
|
||||
0
|
||||
}
|
||||
current(x) = topOffset(-1) + topOffset(0)
|
||||
print(current(x))
|
||||
print(" ")
|
||||
if (x < current.length - 1)
|
||||
fibIn(x + 1, previous, current)
|
||||
else if (current.length < n) {
|
||||
println()
|
||||
fibIn(0, current, new Array[Int](current.length+1))
|
||||
}
|
||||
}
|
||||
println(1)
|
||||
fibIn(0, Array(1), new Array[Int](2))
|
||||
}
|
||||
}
|
||||
|
||||
88
WS23_24/Anwendungsentwicklung/src/P11/test.c
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// Created by jordi on 1/8/24.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
void strcpy(char *duplikat, const char *original) {
|
||||
while ((*duplikat++ = *original++));
|
||||
}
|
||||
void strcpy2(char *duplikat, const char *original) {
|
||||
int i = 0;
|
||||
while ((duplikat[i] = original[i]) != '\0') {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
void aufgabe3(){
|
||||
printf("Aufgabe 3\n");
|
||||
char original[] = "Hallo Welt";
|
||||
|
||||
char duplikat[20];
|
||||
strcpy(duplikat, original);
|
||||
printf("Original: %s\n", original);
|
||||
printf("Duplikat: %s\n", duplikat);
|
||||
|
||||
char duplikat2[20];
|
||||
strcpy2(duplikat2, original);
|
||||
printf("Original: %s\n", original);
|
||||
printf("Duplikat: %s\n", duplikat2);
|
||||
}
|
||||
|
||||
|
||||
void tauschen(int* int1, int* int2){
|
||||
int tmp = *int2;
|
||||
*int2 = *int1;
|
||||
*int1 = tmp;
|
||||
}
|
||||
void aufgabe4(){
|
||||
int int1 = 1;
|
||||
int int2 = 2;
|
||||
|
||||
printf("Int1 is %d\n",int1);
|
||||
printf("Int2 is %d\n",int2);
|
||||
tauschen(&int1,&int2);
|
||||
printf("Nach dem Vertauschen:\n");
|
||||
printf("Int1 is %d\n",int1);
|
||||
printf("Int2 is %d\n",int2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ARRAY_SIZE 5
|
||||
|
||||
|
||||
void initializeArray(int arr[]) {
|
||||
printf("Geben Sie %d Ganzzahlen für das Array ein:\n", ARRAY_SIZE);
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
scanf("%d", &arr[i]);
|
||||
}
|
||||
}
|
||||
void printArray(int arr[]) {
|
||||
printf("Das Array lautet: ");
|
||||
int *ptr = arr;
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
printf("%d ", *(ptr + i));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
int sumArray(const int arr[]) {
|
||||
int sum = 0;
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
sum += *(arr + i);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void aufgabe5() {
|
||||
int arr[ARRAY_SIZE];
|
||||
initializeArray(arr);
|
||||
printArray(arr);
|
||||
int sum = sumArray(arr);
|
||||
printf("Die Summe der Elemente im Array beträgt: %d\n", sum);
|
||||
}
|
||||
|
||||
int main() {
|
||||
aufgabe3();
|
||||
aufgabe4();
|
||||
aufgabe5();
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
//
|
||||
// Created by jordi on 1/8/24.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("hallo");
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package P6;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -14,6 +15,7 @@ public class Praktikum {
|
||||
var time = java.time.LocalDateTime.now();
|
||||
|
||||
Path p = Paths.get(home, "java-text.tmp");
|
||||
|
||||
try {
|
||||
if (Files.exists(p))
|
||||
Files.delete(p);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package P7;
|
||||
|
||||
public class Gabel {
|
||||
public class Fork {
|
||||
public boolean takable =true;
|
||||
int id;
|
||||
public Gabel(int pID){
|
||||
public Fork(int pID){
|
||||
id=pID;
|
||||
}
|
||||
public synchronized boolean take(String name) {
|
||||
@@ -17,5 +17,4 @@ public class Gabel {
|
||||
System.out.println(name+" hat Gabel "+id+" zuruckgelegt");
|
||||
takable = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package P7;
|
||||
|
||||
public class Philosoph extends Thread {
|
||||
String name;
|
||||
Gabel left,right;
|
||||
public Philosoph(String pname,Gabel pleft, Gabel pright){
|
||||
Fork left,right;
|
||||
public Philosoph(String pname, Fork pleft, Fork pright){
|
||||
name=pname;
|
||||
left=pleft;
|
||||
right=pright;
|
||||
@@ -21,12 +21,14 @@ public class Philosoph extends Thread {
|
||||
if(right.take(name)){
|
||||
if(left.take(name)){
|
||||
System.out.println(name+" " +"Yeeting");
|
||||
right.place(name);
|
||||
left.place(name);
|
||||
}else{
|
||||
right.place(name);
|
||||
System.out.println("kein links");
|
||||
System.out.println(name+" hat kein links");
|
||||
}
|
||||
}else {
|
||||
System.out.println("kein rechts");
|
||||
System.out.println(name+" hat kein rechts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ public class Philosophen {
|
||||
//int n =Integer.parseInt(args[0]);
|
||||
int n = 5;
|
||||
var pList = new ArrayList<Thread>();
|
||||
var gList= new ArrayList<Gabel>();
|
||||
var gList= new ArrayList<Fork>();
|
||||
for(int it =0;it<n;it++){
|
||||
Gabel g=new Gabel(it);
|
||||
Fork g=new Fork(it);
|
||||
gList.add(g);
|
||||
}
|
||||
for(int i=0;i<n;i++){
|
||||
Gabel left = gList.get(i);
|
||||
Gabel right;
|
||||
Fork left = gList.get(i);
|
||||
Fork right;
|
||||
if (i==0){
|
||||
right = gList.get(gList.size()-1);
|
||||
}else {
|
||||
@@ -24,7 +24,5 @@ public class Philosophen {
|
||||
pList.add(t);
|
||||
t.start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
45
WS23_24/Anwendungsentwicklung/src/P9/Counter.scala
Normal file
@@ -0,0 +1,45 @@
|
||||
package P9
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
||||
object Counter {
|
||||
def main(args: Array[String]) {
|
||||
val arr = Array('a', 'b', 'a', 'a', 'c', 'c', 'c', 'b', 'b', 'a')
|
||||
val arr2 = Array(1,1,1,3,3,2,2,1,1,4)
|
||||
startCount(arr2)
|
||||
println("Count 2: ")
|
||||
startCount2(arr)
|
||||
}
|
||||
|
||||
def startCount(arr: Array[?]): Unit = {
|
||||
val dsArr = arr.distinct
|
||||
val list: List[Int] = List()
|
||||
count(arr, dsArr,0)
|
||||
}
|
||||
def startCount2(arr: Array[?]): Unit = {
|
||||
val dsArr = arr.distinct
|
||||
val list: List[Int] = List()
|
||||
count2(arr, dsArr,0)
|
||||
}
|
||||
|
||||
//Endrekursiv
|
||||
@tailrec
|
||||
def count(searchArr: Array[?], containArr: Array[?], index:Int): Unit = {
|
||||
if (index >= containArr.length)
|
||||
println("end")
|
||||
else {
|
||||
println(containArr(index).toString + ": " + searchArr.count(_==containArr(index)))
|
||||
count(searchArr, containArr, index+1)
|
||||
}
|
||||
}
|
||||
|
||||
//Rekursiv, aber nicht Endrekursiv
|
||||
def count2(searchArr: Array[?], containArr: Array[?], index:Int): Unit = {
|
||||
if (index >= containArr.length)
|
||||
println("end")
|
||||
else {
|
||||
count2(searchArr, containArr, index+1)
|
||||
println(containArr(index).toString + ": " + searchArr.count(_==containArr(index)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package P9
|
||||
|
||||
object Numbers {
|
||||
def main(args: Array[String]) {
|
||||
println()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
object Palindrom {
|
||||
def main(args: Array[String]) {
|
||||
println(startCheck("ABCCBA"))
|
||||
}
|
||||
|
||||
def startCheck(word: String): Boolean = {
|
||||
check(0, word)
|
||||
}
|
||||
def check(i: Int, word: String): Boolean = {
|
||||
if((word.length/2)<=i) true else if (word.charAt(i)==word.charAt(word.length-i-1)&&check(i+1,word)) true else false
|
||||
}
|
||||
}
|
||||
28
WS23_24/Anwendungsentwicklung/src/P9/Palindrome.scala
Normal file
@@ -0,0 +1,28 @@
|
||||
package P9
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
||||
object Palindrome {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val word = "ABCDCBA"
|
||||
println(startCheck(word))
|
||||
println(startCheck2(word))
|
||||
}
|
||||
|
||||
private def startCheck(word: String): Boolean = {
|
||||
check(0, word)
|
||||
}
|
||||
|
||||
private def startCheck2(word: String): Boolean = {
|
||||
check2(0, word)
|
||||
}
|
||||
|
||||
@tailrec
|
||||
private def check(i: Int, word: String): Boolean = {
|
||||
((word.length / 2) <= i) || (word.charAt(i) == word.charAt(word.length - i - 1) && check(i + 1, word)) //endrekursiv i guess
|
||||
}
|
||||
|
||||
private def check2(i: Int, word: String): Boolean = {
|
||||
((word.length / 2) <= i) || check2(i + 1, word) && (word.charAt(i) == word.charAt(word.length - i - 1)) //rekursiv, aber nicht endrekursiv
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package PhilosophenPak;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PhilosophenAIO {
|
||||
public static void main(String[] args) {
|
||||
//int n =Integer.parseInt(args[0]);
|
||||
int n = 5;
|
||||
var pList = new ArrayList<Thread>();
|
||||
var gList= new ArrayList<Gabel>();
|
||||
for(int it =0;it<n;it++){
|
||||
Gabel g=new Gabel(it);
|
||||
gList.add(g);
|
||||
}
|
||||
for(int i=0;i<n;i++){
|
||||
Gabel left = gList.get(i);
|
||||
Gabel right;
|
||||
if (i==0){
|
||||
right = gList.get(gList.size()-1);
|
||||
}else {
|
||||
right = gList.get(i-1);
|
||||
}
|
||||
Thread t = new Philosoph("Philosoph "+i,left, right);
|
||||
pList.add(t);
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Philosoph extends Thread {
|
||||
String name;
|
||||
Gabel left,right;
|
||||
public Philosoph(String pname,Gabel pleft, Gabel pright){
|
||||
name=pname;
|
||||
left=pleft;
|
||||
right=pright;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (true){
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(right.take(name)){
|
||||
if(left.take(name)){
|
||||
System.out.println(name+" " +"Yeeting");
|
||||
right.place(name);
|
||||
left.place(name);
|
||||
}else{
|
||||
right.place(name);
|
||||
System.out.println(name+" hat kein links");
|
||||
}
|
||||
}else {
|
||||
System.out.println(name+" hat kein rechts");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Gabel {
|
||||
public boolean takable =true;
|
||||
int id;
|
||||
public Gabel(int pID){
|
||||
id=pID;
|
||||
}
|
||||
public synchronized boolean take(String name) {
|
||||
if(!takable)
|
||||
return false;
|
||||
System.out.println(name+" hat Gabel "+id+" genommen");
|
||||
takable=false;
|
||||
return true;
|
||||
}
|
||||
public synchronized void place(String name){
|
||||
System.out.println(name+" hat Gabel "+id+" zuruckgelegt");
|
||||
takable = true;
|
||||
}
|
||||
}
|
||||
8
WS24_25/PyCharm/pythonProject/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
WS24_25/PyCharm/pythonProject/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
7
WS24_25/PyCharm/pythonProject/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (pythonProject)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
WS24_25/PyCharm/pythonProject/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
11
WS24_25/PyCharm/pythonProject/.idea/pythonProject.iml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
WS24_25/PyCharm/pythonProject/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
17
WS24_25/PyCharm/pythonProject/A/a.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from PIL import Image
|
||||
|
||||
# Open the image
|
||||
image = Image.open('alles_mit_flag.bmp')
|
||||
|
||||
# Split the image into Red, Green, and Blue channels
|
||||
red, green, blue = image.split()
|
||||
|
||||
# Save each channel as a separate grayscale image
|
||||
red.save('red_channel.bmp')
|
||||
green.save('green_channel.bmp')
|
||||
blue.save('blue_channel.bmp')
|
||||
|
||||
# Optionally, show the images
|
||||
red.show()
|
||||
green.show()
|
||||
blue.show()
|
||||
BIN
WS24_25/PyCharm/pythonProject/A/alles_mit_flag.bmp
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
WS24_25/PyCharm/pythonProject/A/blue_channel.bmp
Normal file
|
After Width: | Height: | Size: 793 KiB |
46
WS24_25/PyCharm/pythonProject/A/bruteForce.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import requests
|
||||
from fake_useragent import UserAgent
|
||||
|
||||
# URL to brute force
|
||||
url = "https://ctfd.labs.inf.fh-dortmund.de/ctfd-challenge-4"
|
||||
|
||||
# Create a UserAgent instance
|
||||
ua = UserAgent()
|
||||
|
||||
# Default HTML content
|
||||
default_response = """<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>User Agent Info</title>
|
||||
<link rel="stylesheet" href="/ctfd-challenge-4/static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>IBM Workstation Server</h1>
|
||||
<p>Diese Seite bedient ausschließlich von IBM eingerichtete Geräte</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
# Function to brute force headers
|
||||
def brute_force_user_agent():
|
||||
for _ in range(500000): # Adjust the range for the number of User-Agents you want to try
|
||||
user_agent = ua.random # Generate a random User-Agent
|
||||
headers = {
|
||||
"User-Agent": user_agent
|
||||
}
|
||||
try:
|
||||
response = requests.get(url, headers=headers)
|
||||
if response.text.strip() != default_response.strip():
|
||||
print(f"User-Agent '{user_agent}' gives a different response:")
|
||||
print(response.text)
|
||||
return
|
||||
# else:
|
||||
# print(f"Nope: '{user_agent}'")
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Error with User-Agent '{user_agent}': {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
brute_force_user_agent()
|
||||
BIN
WS24_25/PyCharm/pythonProject/A/green_channel.bmp
Normal file
|
After Width: | Height: | Size: 793 KiB |
BIN
WS24_25/PyCharm/pythonProject/A/red_channel.bmp
Normal file
|
After Width: | Height: | Size: 793 KiB |
51
WS24_25/PyCharm/pythonProject/P1/kek.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# def fac(x,y=2):
|
||||
# return x**y
|
||||
# list = [1,2,3]
|
||||
# list2 =[]
|
||||
# for i in range(len(list)):
|
||||
# list[i] = fac(list[i])
|
||||
# print (list)
|
||||
|
||||
|
||||
class Lecture:
|
||||
def __init__(self, title):
|
||||
"""
|
||||
Initializes a new Lecture instance with a title and an empty list of students.
|
||||
|
||||
:param title: Title of the lecture
|
||||
"""
|
||||
self.title = title
|
||||
self.students = []
|
||||
|
||||
def add_student(self, student_name):
|
||||
"""
|
||||
Adds a student to the lecture.
|
||||
|
||||
:param student_name: Name of the student to be added
|
||||
"""
|
||||
if student_name not in self.students:
|
||||
self.students.append(student_name)
|
||||
print(f"{student_name} has been added to the lecture '{self.title}'.")
|
||||
else:
|
||||
print(f"{student_name} is already enrolled in the lecture '{self.title}'.")
|
||||
|
||||
def number_of_students(self):
|
||||
"""
|
||||
Returns the number of students enrolled in the lecture.
|
||||
|
||||
:return: The count of students
|
||||
"""
|
||||
return len(self.students)
|
||||
|
||||
|
||||
# Example usage
|
||||
|
||||
# Create a new lecture
|
||||
python_lecture = Lecture("Introduction to Python")
|
||||
# Add students
|
||||
python_lecture.add_student("Alice")
|
||||
python_lecture.add_student("Bob")
|
||||
python_lecture.add_student("Alice") # Attempt to add Alice again
|
||||
|
||||
# Get the number of students
|
||||
print(f"Number of students enrolled in '{python_lecture.title}': {python_lecture.number_of_students()}")
|
||||
2931
WS24_25/PyCharm/pythonProject/P11/AmesHousing.csv
Normal file
70
WS24_25/PyCharm/pythonProject/P11/excercise.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import pandas as pd
|
||||
|
||||
# Load the dataset: Order;Lot Area;Street;Neighborhood;Bldg Type;House Style;Overall Qual;Overall Cond;Year Built;Year Remod/Add;1st Flr over Lot Area;1st Flr SF;Mo Sold;Yr Sold;Sale Type;Sale Condition;SalePrice
|
||||
data = pd.read_csv("AmesHousing.csv", sep=';')
|
||||
# View dataset structure
|
||||
print(data.head())
|
||||
print(data.info())
|
||||
|
||||
# Compute "years since built"
|
||||
data['Years Since Built'] = data['Yr Sold'] - data['Year Built']
|
||||
|
||||
# Compute "years since remod/add"
|
||||
data['Years Since Remod/Add'] = data['Yr Sold'] - data['Year Remod/Add']
|
||||
|
||||
# View the updated dataset
|
||||
print(data[['Years Since Built', 'Years Since Remod/Add']].head())
|
||||
|
||||
# Categorize SalePrice into "cheap" and "expensive"
|
||||
data['Price Category'] = data['SalePrice'].apply(lambda x: 'cheap' if x <= 160000 else 'expensive')
|
||||
|
||||
# View the updated dataset
|
||||
print(data[['SalePrice', 'Price Category']].head())
|
||||
|
||||
# Define a threshold for low-frequency values
|
||||
threshold = 5
|
||||
|
||||
# Iterate through each column
|
||||
for column in data.columns:
|
||||
# Only process categorical columns (non-numeric, or treat numeric as categorical if needed)
|
||||
if data[column].dtype == 'object' or data[column].nunique() < 20: # Customize this condition for your use case
|
||||
# Count frequency of each value
|
||||
frequencies = data[column].value_counts()
|
||||
|
||||
# Identify categories with few occurrences
|
||||
low_frequency_values = frequencies[frequencies < threshold].index
|
||||
|
||||
# Replace infrequent values with "Other"
|
||||
data[column] = data[column].apply(lambda x: 'Other' if x in low_frequency_values else x)
|
||||
|
||||
# View the dataframe after reclassification
|
||||
print(data.head())
|
||||
|
||||
# Threshold for imbalance percentage (e.g., any class with >99% of the data)
|
||||
imbalance_threshold = 0.99
|
||||
|
||||
# Identify columns to drop
|
||||
columns_to_drop = []
|
||||
|
||||
# Loop through each column in the DataFrame
|
||||
for column in data.columns:
|
||||
# Only analyze categorical variables
|
||||
if data[column].dtype == 'object' or data[column].nunique() < 20:
|
||||
# Compute class distribution
|
||||
class_distribution = data[column].value_counts(normalize=True)
|
||||
|
||||
# Check if any single class exceeds the imbalance threshold
|
||||
if class_distribution.max() > imbalance_threshold:
|
||||
print(f"Extreme imbalance found in '{column}' (Dropping column)")
|
||||
columns_to_drop.append(column)
|
||||
|
||||
# You might want to drop other irrelevant variables explicitly
|
||||
# Add them to columns_to_drop if not needed
|
||||
# Example: columns_to_drop.append('Unnamed_column')
|
||||
|
||||
# Drop the identified columns
|
||||
data = data.drop(columns=columns_to_drop)
|
||||
|
||||
# Output the cleaned dataset
|
||||
print(f"Columns dropped: {columns_to_drop}")
|
||||
print(data.head())
|
||||
2931
WS24_25/PyCharm/pythonProject/P2/AmesHousing.csv
Normal file
55672
WS24_25/PyCharm/pythonProject/P2/AmesHousing.json
Normal file
29
WS24_25/PyCharm/pythonProject/P2/cvsToJson.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import json
|
||||
|
||||
|
||||
def csv_to_json(input_file: str, output_file: str):
|
||||
data = []
|
||||
|
||||
# Step 1: Read the CSV file manually
|
||||
with open(input_file, 'r') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
# Step 2: Parse the first line to get the headers
|
||||
headers = lines[0].strip().split(';')
|
||||
|
||||
# Step 3: Parse the subsequent lines to get the data
|
||||
for line in lines[1:]:
|
||||
values = line.strip().split(';')
|
||||
# Create a dictionary for each row
|
||||
row_dict = {headers[i]: values[i] for i in range(len(headers))}
|
||||
data.append(row_dict)
|
||||
|
||||
# Step 4: Save the data to a JSON file
|
||||
with open(output_file, 'w') as json_file:
|
||||
json.dump(data, json_file, indent=4)
|
||||
|
||||
|
||||
# Usage
|
||||
input_csv_file = 'AmesHousing.csv'
|
||||
output_json_file = 'AmesHousing.json'
|
||||
csv_to_json(input_csv_file, output_json_file)
|
||||
19
WS24_25/PyCharm/pythonProject/P2/summary.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def summarize_csv(file_path: str):
|
||||
# Step 1: Load the CSV file using pandas
|
||||
df = pd.read_csv(file_path, delimiter=';')
|
||||
|
||||
# Step 2: Print general information about the data
|
||||
print("Data Info:")
|
||||
print(df.info())
|
||||
|
||||
# Step 3: Print statistical summary of the numerical columns
|
||||
print("\nStatistical Summary:")
|
||||
print(df.describe())
|
||||
|
||||
|
||||
# Usage
|
||||
input_csv_file = 'AmesHousing.csv'
|
||||
summarize_csv(input_csv_file)
|
||||
9
WS24_25/PyCharm/pythonProject/P3/api.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import requests
|
||||
import json
|
||||
import pandas as pd
|
||||
api_url = "https://overfast-api.tekrop.fr/heroes"
|
||||
response = requests.get(api_url)
|
||||
json_data = response.json()
|
||||
with open('heroes.json', 'w') as outfile: json.dump(json_data, outfile)
|
||||
df = pd.read_json(json.dumps(json_data))
|
||||
csv_data = df.to_csv('csv_data.csv')
|
||||
42
WS24_25/PyCharm/pythonProject/P3/csv_data.csv
Normal file
@@ -0,0 +1,42 @@
|
||||
,key,name,portrait,role
|
||||
0,ana,Ana,https://d15f34w2p8l1cc.cloudfront.net/overwatch/3429c394716364bbef802180e9763d04812757c205e1b4568bc321772096ed86.png,support
|
||||
1,ashe,Ashe,https://d15f34w2p8l1cc.cloudfront.net/overwatch/8dc2a024c9b7d95c7141b2ef065590dbc8d9018d12ad15f76b01923986702228.png,damage
|
||||
2,baptiste,Baptiste,https://d15f34w2p8l1cc.cloudfront.net/overwatch/f979896f74ba22db2a92a85ae1260124ab0a26665957a624365e0f96e5ac5b5c.png,support
|
||||
3,bastion,Bastion,https://d15f34w2p8l1cc.cloudfront.net/overwatch/4d715f722c42215072b5dd0240904aaed7b5285df0b2b082d0a7f1865b5ea992.png,damage
|
||||
4,brigitte,Brigitte,https://d15f34w2p8l1cc.cloudfront.net/overwatch/48392820c6976ee1cd8dde13e71df85bf15560083ee5c8658fe7c298095d619a.png,support
|
||||
5,cassidy,Cassidy,https://d15f34w2p8l1cc.cloudfront.net/overwatch/6cfb48b5597b657c2eafb1277dc5eef4a07eae90c265fcd37ed798189619f0a5.png,damage
|
||||
6,doomfist,Doomfist,https://d15f34w2p8l1cc.cloudfront.net/overwatch/13750471c693c1a360eb19d5ace229c8599a729cd961d72ebee0e157657b7d18.png,tank
|
||||
7,dva,D.Va,https://d15f34w2p8l1cc.cloudfront.net/overwatch/ca114f72193e4d58a85c087e9409242f1a31e808cf4058678b8cbf767c2a9a0a.png,tank
|
||||
8,echo,Echo,https://d15f34w2p8l1cc.cloudfront.net/overwatch/f086bf235cc6b7f138609594218a8385c8e5f6405a39eceb0deb9afb429619fe.png,damage
|
||||
9,genji,Genji,https://d15f34w2p8l1cc.cloudfront.net/overwatch/4edf5ea6d58c449a2aeb619a3fda9fff36a069dfbe4da8bc5d8ec1c758ddb8dc.png,damage
|
||||
10,hanzo,Hanzo,https://d15f34w2p8l1cc.cloudfront.net/overwatch/aecd8fa677f0093344fab7ccb7c37516c764df3f5ff339a5a845a030a27ba7e0.png,damage
|
||||
11,illari,Illari,https://d15f34w2p8l1cc.cloudfront.net/overwatch/5ea986038f9d307bd4613d5e6f2c4c8e7f15f30ceeeabbdd7a06637a38f17e1f.png,support
|
||||
12,junker-queen,Junker Queen,https://d15f34w2p8l1cc.cloudfront.net/overwatch/cef2406b2244b80506f83b8fb9ebaf214f41fa8795cbeef84026cd8018561d04.png,tank
|
||||
13,junkrat,Junkrat,https://d15f34w2p8l1cc.cloudfront.net/overwatch/037e3df083624e5480f8996821287479a375f62b470572a22773da0eaf9441d0.png,damage
|
||||
14,juno,Juno,https://d15f34w2p8l1cc.cloudfront.net/overwatch/585b2d60cbd3c271b6ad5ad0922537af0c6836fab6c89cb9979077f7bb0832b5.png,support
|
||||
15,kiriko,Kiriko,https://d15f34w2p8l1cc.cloudfront.net/overwatch/088aff2153bdfa426984b1d5c912f6af0ab313f0865a81be0edd114e9a2f79f9.png,support
|
||||
16,lifeweaver,Lifeweaver,https://d15f34w2p8l1cc.cloudfront.net/overwatch/39d4514f1b858bc228035b09d5a74ed41f8eeefc9a0d1873570b216ba04334df.png,support
|
||||
17,lucio,Lúcio,https://d15f34w2p8l1cc.cloudfront.net/overwatch/e2ff2527610a0fbe0c9956f80925123ef3e66c213003e29d37436de30b90e4e1.png,support
|
||||
18,mauga,Mauga,https://d15f34w2p8l1cc.cloudfront.net/overwatch/9ee3f5a62893091d575ec0a0d66df878597086374202c6fc7da2d63320a7d02e.png,tank
|
||||
19,mei,Mei,https://d15f34w2p8l1cc.cloudfront.net/overwatch/1533fcb0ee1d3f9586f84b4067c6f63eca3322c1c661f69bfb41cd9e4f4bcc11.png,damage
|
||||
20,mercy,Mercy,https://d15f34w2p8l1cc.cloudfront.net/overwatch/2508ddd39a178d5f6ae993ab43eeb3e7961e5a54a9507e6ae347381193f28943.png,support
|
||||
21,moira,Moira,https://d15f34w2p8l1cc.cloudfront.net/overwatch/000beeb5606e01497897fa9210dd3b1e78e1159ebfd8afdc9e989047d7d3d08f.png,support
|
||||
22,orisa,Orisa,https://d15f34w2p8l1cc.cloudfront.net/overwatch/71e96294617e81051d120b5d04b491bb1ea40e2933da44d6631aae149aac411d.png,tank
|
||||
23,pharah,Pharah,https://d15f34w2p8l1cc.cloudfront.net/overwatch/f8261595eca3e43e3b37cadb8161902cc416e38b7e0caa855f4555001156d814.png,damage
|
||||
24,ramattra,Ramattra,https://d15f34w2p8l1cc.cloudfront.net/overwatch/3e0367155e1940a24da076c6f1f065aacede88dbc323631491aa0cd5a51e0b66.png,tank
|
||||
25,reaper,Reaper,https://d15f34w2p8l1cc.cloudfront.net/overwatch/2edb9af69d987bb503cd31f7013ae693640e692b321a73d175957b9e64394f40.png,damage
|
||||
26,reinhardt,Reinhardt,https://d15f34w2p8l1cc.cloudfront.net/overwatch/490d2f79f8547d6e364306af60c8184fb8024b8e55809e4cc501126109981a65.png,tank
|
||||
27,roadhog,Roadhog,https://d15f34w2p8l1cc.cloudfront.net/overwatch/72e02e747b66b61fcbc02d35d350770b3ec7cbaabd0a7ca17c0d82743d43a7e8.png,tank
|
||||
28,sigma,Sigma,https://d15f34w2p8l1cc.cloudfront.net/overwatch/cd7a4c0a0df8924afb2c9f6df864ed040f20250440c36ca2eb634acf6609c5e4.png,tank
|
||||
29,sojourn,Sojourn,https://d15f34w2p8l1cc.cloudfront.net/overwatch/a53bf7ad9d2f33aaf9199a00989f86d4ba1f67c281ba550312c7d96e70fec4ea.png,damage
|
||||
30,soldier-76,Soldier: 76,https://d15f34w2p8l1cc.cloudfront.net/overwatch/20b4ef00ed05d6dba75df228241ed528df7b6c9556f04c8070bad1e2f89e0ff5.png,damage
|
||||
31,sombra,Sombra,https://d15f34w2p8l1cc.cloudfront.net/overwatch/bca8532688f01b071806063b9472f1c0f9fc9c7948e6b59e210006e69cec9022.png,damage
|
||||
32,symmetra,Symmetra,https://d15f34w2p8l1cc.cloudfront.net/overwatch/7f2024c5387c9d76d944a5db021c2774d1e9d7cbf39e9b6a35b364d38ea250ac.png,damage
|
||||
33,torbjorn,Torbjörn,https://d15f34w2p8l1cc.cloudfront.net/overwatch/1309ab1add1cc19189a2c8bc7b1471f88efa1073e9705d2397fdb37d45707d01.png,damage
|
||||
34,tracer,Tracer,https://d15f34w2p8l1cc.cloudfront.net/overwatch/a66413200e934da19540afac965cfe8a2de4ada593d9a52d53108bb28e8bbc9c.png,damage
|
||||
35,venture,Venture,https://d15f34w2p8l1cc.cloudfront.net/overwatch/7e33dd756c8a1abca519af6c3bf26813f2f81d39885373539efcf8442c4bc647.png,damage
|
||||
36,widowmaker,Widowmaker,https://d15f34w2p8l1cc.cloudfront.net/overwatch/a714f1cb33cc91c6b5b3e89ffe7e325b99e7c89cc8e8feced594f81305147efe.png,damage
|
||||
37,winston,Winston,https://d15f34w2p8l1cc.cloudfront.net/overwatch/bd9c8e634d89488459dfc1aeb21b602fa5c39aa05601a4167682f3a3fed4e0ee.png,tank
|
||||
38,wrecking-ball,Wrecking Ball,https://d15f34w2p8l1cc.cloudfront.net/overwatch/5c18e39ce567ee8a84078f775b9f76a2ba891de601c059a3d2b46b61ae4afb42.png,tank
|
||||
39,zarya,Zarya,https://d15f34w2p8l1cc.cloudfront.net/overwatch/8819ba85823136640d8eba2af6fd7b19d46b9ee8ab192a4e06f396d1e5231f7a.png,tank
|
||||
40,zenyatta,Zenyatta,https://d15f34w2p8l1cc.cloudfront.net/overwatch/71cabc939c577581f66b952f9c70891db779251e8e70f29de3c7bf494edacfe4.png,support
|
||||
|
4
WS24_25/PyCharm/pythonProject/P3/getData.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import pandas as pd
|
||||
df = pd.read_csv('labels.csv')
|
||||
label_counts = df['Label'].value_counts()
|
||||
print(label_counts)
|
||||
1
WS24_25/PyCharm/pythonProject/P3/heroes.json
Normal file
351
WS24_25/PyCharm/pythonProject/P3/labels.csv
Normal file
@@ -0,0 +1,351 @@
|
||||
Image Name,Label
|
||||
img_239.jpg,8
|
||||
img_111.jpg,0
|
||||
img_9.jpg,0
|
||||
img_341.jpg,6
|
||||
img_60.jpg,0
|
||||
img_268.jpg,8
|
||||
img_241.jpg,8
|
||||
img_113.jpg,4
|
||||
img_247.jpg,9
|
||||
img_138.jpg,1
|
||||
img_307.jpg,7
|
||||
img_34.jpg,2
|
||||
img_210.jpg,2
|
||||
img_318.jpg,4
|
||||
img_178.jpg,4
|
||||
img_261.jpg,6
|
||||
img_271.jpg,6
|
||||
img_167.jpg,7
|
||||
img_107.jpg,0
|
||||
img_170.jpg,0
|
||||
img_193.jpg,4
|
||||
img_164.jpg,5
|
||||
img_38.jpg,5
|
||||
img_57.jpg,1
|
||||
img_154.jpg,6
|
||||
img_297.jpg,3
|
||||
img_46.jpg,7
|
||||
img_220.jpg,4
|
||||
img_69.jpg,0
|
||||
img_267.jpg,6
|
||||
img_293.jpg,7
|
||||
img_184.jpg,2
|
||||
img_45.jpg,8
|
||||
img_249.jpg,3
|
||||
img_180.jpg,2
|
||||
img_198.jpg,7
|
||||
img_330.jpg,3
|
||||
img_206.jpg,0
|
||||
img_92.jpg,0
|
||||
img_75.jpg,2
|
||||
img_73.jpg,8
|
||||
img_182.jpg,8
|
||||
img_328.jpg,1
|
||||
img_202.jpg,9
|
||||
img_291.jpg,5
|
||||
img_87.jpg,4
|
||||
img_269.jpg,3
|
||||
img_326.jpg,4
|
||||
img_89.jpg,6
|
||||
img_302.jpg,9
|
||||
img_47.jpg,8
|
||||
img_131.jpg,3
|
||||
img_155.jpg,5
|
||||
img_309.jpg,4
|
||||
img_20.jpg,0
|
||||
img_49.jpg,6
|
||||
img_160.jpg,8
|
||||
img_171.jpg,2
|
||||
img_132.jpg,5
|
||||
img_72.jpg,5
|
||||
img_100.jpg,4
|
||||
img_48.jpg,2
|
||||
img_316.jpg,3
|
||||
img_266.jpg,0
|
||||
img_41.jpg,7
|
||||
img_71.jpg,6
|
||||
img_156.jpg,3
|
||||
img_151.jpg,4
|
||||
img_121.jpg,3
|
||||
img_70.jpg,1
|
||||
img_147.jpg,7
|
||||
img_203.jpg,0
|
||||
img_91.jpg,2
|
||||
img_254.jpg,3
|
||||
img_67.jpg,1
|
||||
img_233.jpg,9
|
||||
img_336.jpg,9
|
||||
img_142.jpg,3
|
||||
img_248.jpg,8
|
||||
img_124.jpg,8
|
||||
img_216.jpg,2
|
||||
img_13.jpg,4
|
||||
img_343.jpg,1
|
||||
img_272.jpg,0
|
||||
img_252.jpg,7
|
||||
img_54.jpg,3
|
||||
img_333.jpg,1
|
||||
img_94.jpg,6
|
||||
img_191.jpg,6
|
||||
img_232.jpg,4
|
||||
img_42.jpg,7
|
||||
img_110.jpg,8
|
||||
img_201.jpg,1
|
||||
img_37.jpg,5
|
||||
img_144.jpg,5
|
||||
img_262.jpg,3
|
||||
img_162.jpg,0
|
||||
img_277.jpg,1
|
||||
img_29.jpg,4
|
||||
img_62.jpg,1
|
||||
img_234.jpg,1
|
||||
img_215.jpg,3
|
||||
img_97.jpg,3
|
||||
img_259.jpg,4
|
||||
img_8.jpg,3
|
||||
img_17.jpg,3
|
||||
img_349.jpg,2
|
||||
img_14.jpg,0
|
||||
img_211.jpg,0
|
||||
img_317.jpg,8
|
||||
img_213.jpg,3
|
||||
img_43.jpg,4
|
||||
img_96.jpg,4
|
||||
img_258.jpg,1
|
||||
img_109.jpg,0
|
||||
img_189.jpg,6
|
||||
img_298.jpg,0
|
||||
img_65.jpg,0
|
||||
img_313.jpg,9
|
||||
img_337.jpg,0
|
||||
img_344.jpg,8
|
||||
img_7.jpg,0
|
||||
img_16.jpg,3
|
||||
img_218.jpg,6
|
||||
img_240.jpg,6
|
||||
img_165.jpg,1
|
||||
img_303.jpg,8
|
||||
img_177.jpg,7
|
||||
img_288.jpg,1
|
||||
img_53.jpg,8
|
||||
img_315.jpg,0
|
||||
img_139.jpg,3
|
||||
img_222.jpg,3
|
||||
img_296.jpg,6
|
||||
img_55.jpg,8
|
||||
img_76.jpg,8
|
||||
img_314.jpg,0
|
||||
img_279.jpg,8
|
||||
img_5.jpg,3
|
||||
img_85.jpg,9
|
||||
img_229.jpg,1
|
||||
img_145.jpg,5
|
||||
img_322.jpg,1
|
||||
img_115.jpg,1
|
||||
img_26.jpg,4
|
||||
img_33.jpg,4
|
||||
img_321.jpg,4
|
||||
img_284.jpg,0
|
||||
img_150.jpg,8
|
||||
img_86.jpg,2
|
||||
img_129.jpg,7
|
||||
img_11.jpg,5
|
||||
img_331.jpg,6
|
||||
img_339.jpg,6
|
||||
img_244.jpg,8
|
||||
img_81.jpg,5
|
||||
img_263.jpg,3
|
||||
img_56.jpg,2
|
||||
img_273.jpg,6
|
||||
img_83.jpg,1
|
||||
img_30.jpg,7
|
||||
img_22.jpg,1
|
||||
img_224.jpg,2
|
||||
img_169.jpg,3
|
||||
img_292.jpg,7
|
||||
img_197.jpg,9
|
||||
img_122.jpg,7
|
||||
img_275.jpg,9
|
||||
img_231.jpg,0
|
||||
img_157.jpg,7
|
||||
img_238.jpg,3
|
||||
img_15.jpg,4
|
||||
img_207.jpg,8
|
||||
img_2.jpg,0
|
||||
img_179.jpg,1
|
||||
img_310.jpg,5
|
||||
img_243.jpg,2
|
||||
img_304.jpg,2
|
||||
img_278.jpg,5
|
||||
img_236.jpg,3
|
||||
img_320.jpg,8
|
||||
img_58.jpg,2
|
||||
img_345.jpg,6
|
||||
img_306.jpg,3
|
||||
img_63.jpg,7
|
||||
img_24.jpg,5
|
||||
img_319.jpg,1
|
||||
img_117.jpg,1
|
||||
img_256.jpg,4
|
||||
img_134.jpg,0
|
||||
img_312.jpg,5
|
||||
img_44.jpg,9
|
||||
img_226.jpg,0
|
||||
img_350.jpg,2
|
||||
img_274.jpg,3
|
||||
img_32.jpg,5
|
||||
img_126.jpg,3
|
||||
img_199.jpg,6
|
||||
img_166.jpg,3
|
||||
img_342.jpg,3
|
||||
img_185.jpg,4
|
||||
img_102.jpg,9
|
||||
img_84.jpg,0
|
||||
img_78.jpg,9
|
||||
img_112.jpg,0
|
||||
img_80.jpg,3
|
||||
img_264.jpg,5
|
||||
img_192.jpg,1
|
||||
img_103.jpg,2
|
||||
img_137.jpg,3
|
||||
img_175.jpg,1
|
||||
img_108.jpg,5
|
||||
img_324.jpg,9
|
||||
img_299.jpg,3
|
||||
img_90.jpg,7
|
||||
img_340.jpg,0
|
||||
img_152.jpg,3
|
||||
img_208.jpg,4
|
||||
img_227.jpg,4
|
||||
img_245.jpg,5
|
||||
img_6.jpg,7
|
||||
img_305.jpg,6
|
||||
img_68.jpg,9
|
||||
img_161.jpg,3
|
||||
img_257.jpg,5
|
||||
img_31.jpg,7
|
||||
img_190.jpg,0
|
||||
img_286.jpg,3
|
||||
img_300.jpg,3
|
||||
img_225.jpg,2
|
||||
img_187.jpg,2
|
||||
img_181.jpg,4
|
||||
img_348.jpg,5
|
||||
img_289.jpg,9
|
||||
img_64.jpg,0
|
||||
img_188.jpg,1
|
||||
img_242.jpg,6
|
||||
img_168.jpg,6
|
||||
img_159.jpg,7
|
||||
img_36.jpg,2
|
||||
img_93.jpg,6
|
||||
img_133.jpg,4
|
||||
img_332.jpg,3
|
||||
img_230.jpg,0
|
||||
img_77.jpg,9
|
||||
img_301.jpg,6
|
||||
img_127.jpg,8
|
||||
img_214.jpg,6
|
||||
img_174.jpg,6
|
||||
img_221.jpg,2
|
||||
img_246.jpg,5
|
||||
img_120.jpg,3
|
||||
img_149.jpg,2
|
||||
img_276.jpg,5
|
||||
img_280.jpg,4
|
||||
img_235.jpg,7
|
||||
img_219.jpg,3
|
||||
img_114.jpg,7
|
||||
img_50.jpg,7
|
||||
img_265.jpg,1
|
||||
img_251.jpg,9
|
||||
img_290.jpg,9
|
||||
img_295.jpg,9
|
||||
img_153.jpg,5
|
||||
img_173.jpg,8
|
||||
img_205.jpg,9
|
||||
img_281.jpg,0
|
||||
img_253.jpg,1
|
||||
img_204.jpg,9
|
||||
img_270.jpg,1
|
||||
img_27.jpg,2
|
||||
img_123.jpg,2
|
||||
img_23.jpg,1
|
||||
img_1.jpg,2
|
||||
img_99.jpg,7
|
||||
img_143.jpg,4
|
||||
img_250.jpg,5
|
||||
img_237.jpg,2
|
||||
img_196.jpg,0
|
||||
img_285.jpg,5
|
||||
img_223.jpg,1
|
||||
img_125.jpg,6
|
||||
img_311.jpg,8
|
||||
img_228.jpg,6
|
||||
img_183.jpg,5
|
||||
img_212.jpg,9
|
||||
img_21.jpg,9
|
||||
img_325.jpg,8
|
||||
img_52.jpg,8
|
||||
img_323.jpg,1
|
||||
img_334.jpg,3
|
||||
img_105.jpg,7
|
||||
img_116.jpg,7
|
||||
img_130.jpg,4
|
||||
img_51.jpg,6
|
||||
img_4.jpg,0
|
||||
img_283.jpg,2
|
||||
img_329.jpg,5
|
||||
img_59.jpg,2
|
||||
img_327.jpg,5
|
||||
img_28.jpg,7
|
||||
img_39.jpg,1
|
||||
img_3.jpg,9
|
||||
img_10.jpg,3
|
||||
img_194.jpg,9
|
||||
img_12.jpg,7
|
||||
img_141.jpg,4
|
||||
img_128.jpg,7
|
||||
img_255.jpg,8
|
||||
img_74.jpg,8
|
||||
img_176.jpg,3
|
||||
img_118.jpg,1
|
||||
img_40.jpg,6
|
||||
img_186.jpg,9
|
||||
img_172.jpg,7
|
||||
img_18.jpg,1
|
||||
img_294.jpg,9
|
||||
img_136.jpg,0
|
||||
img_338.jpg,0
|
||||
img_19.jpg,9
|
||||
img_260.jpg,5
|
||||
img_135.jpg,0
|
||||
img_98.jpg,9
|
||||
img_88.jpg,3
|
||||
img_79.jpg,2
|
||||
img_61.jpg,4
|
||||
img_308.jpg,1
|
||||
img_195.jpg,6
|
||||
img_119.jpg,3
|
||||
img_101.jpg,0
|
||||
img_200.jpg,9
|
||||
img_82.jpg,4
|
||||
img_287.jpg,7
|
||||
img_163.jpg,4
|
||||
img_347.jpg,6
|
||||
img_158.jpg,5
|
||||
img_346.jpg,0
|
||||
img_35.jpg,6
|
||||
img_25.jpg,7
|
||||
img_146.jpg,8
|
||||
img_148.jpg,4
|
||||
img_282.jpg,9
|
||||
img_217.jpg,1
|
||||
img_106.jpg,3
|
||||
img_335.jpg,0
|
||||
img_104.jpg,0
|
||||
img_95.jpg,1
|
||||
img_209.jpg,6
|
||||
img_140.jpg,6
|
||||
img_66.jpg,0
|
||||
|
29
WS24_25/PyCharm/pythonProject/P3/numbers.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import csv
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.image as mpimg
|
||||
|
||||
# Set the path to your extracted directory
|
||||
images_path = './numbers'
|
||||
output_csv = 'labels2.csv'
|
||||
|
||||
# Create/open the CSV file for saving labels
|
||||
with open(output_csv, mode='w', newline='') as file:
|
||||
writer = csv.writer(file)
|
||||
writer.writerow(['Image Name', 'Label']) # Header row
|
||||
|
||||
for image_name in os.listdir(images_path):
|
||||
image_path = os.path.join(images_path, image_name)
|
||||
try:
|
||||
img = mpimg.imread(image_path)
|
||||
plt.imshow(img)
|
||||
plt.axis('off')
|
||||
plt.show()
|
||||
|
||||
label = input(f'Enter the label for {image_name}: ')
|
||||
|
||||
writer.writerow([image_name, label])
|
||||
print(f'Label saved for {image_name}: {label}')
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing {image_name}: {e}")
|
||||
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_1.jpg
Normal file
|
After Width: | Height: | Size: 572 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_10.jpg
Normal file
|
After Width: | Height: | Size: 555 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_100.jpg
Normal file
|
After Width: | Height: | Size: 526 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_101.jpg
Normal file
|
After Width: | Height: | Size: 571 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_102.jpg
Normal file
|
After Width: | Height: | Size: 561 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_103.jpg
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_104.jpg
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_105.jpg
Normal file
|
After Width: | Height: | Size: 556 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_106.jpg
Normal file
|
After Width: | Height: | Size: 536 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_107.jpg
Normal file
|
After Width: | Height: | Size: 590 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_108.jpg
Normal file
|
After Width: | Height: | Size: 593 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_109.jpg
Normal file
|
After Width: | Height: | Size: 608 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_11.jpg
Normal file
|
After Width: | Height: | Size: 578 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_110.jpg
Normal file
|
After Width: | Height: | Size: 578 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_111.jpg
Normal file
|
After Width: | Height: | Size: 558 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_112.jpg
Normal file
|
After Width: | Height: | Size: 597 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_113.jpg
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_114.jpg
Normal file
|
After Width: | Height: | Size: 519 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_115.jpg
Normal file
|
After Width: | Height: | Size: 516 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_116.jpg
Normal file
|
After Width: | Height: | Size: 587 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_117.jpg
Normal file
|
After Width: | Height: | Size: 472 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_118.jpg
Normal file
|
After Width: | Height: | Size: 463 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_119.jpg
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_12.jpg
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_120.jpg
Normal file
|
After Width: | Height: | Size: 555 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_121.jpg
Normal file
|
After Width: | Height: | Size: 628 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_122.jpg
Normal file
|
After Width: | Height: | Size: 540 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_123.jpg
Normal file
|
After Width: | Height: | Size: 551 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_124.jpg
Normal file
|
After Width: | Height: | Size: 532 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_125.jpg
Normal file
|
After Width: | Height: | Size: 524 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_126.jpg
Normal file
|
After Width: | Height: | Size: 553 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_127.jpg
Normal file
|
After Width: | Height: | Size: 635 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_128.jpg
Normal file
|
After Width: | Height: | Size: 538 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_129.jpg
Normal file
|
After Width: | Height: | Size: 471 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_13.jpg
Normal file
|
After Width: | Height: | Size: 565 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_130.jpg
Normal file
|
After Width: | Height: | Size: 554 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_131.jpg
Normal file
|
After Width: | Height: | Size: 600 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_132.jpg
Normal file
|
After Width: | Height: | Size: 600 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_133.jpg
Normal file
|
After Width: | Height: | Size: 520 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_134.jpg
Normal file
|
After Width: | Height: | Size: 614 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_135.jpg
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_136.jpg
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_137.jpg
Normal file
|
After Width: | Height: | Size: 558 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_138.jpg
Normal file
|
After Width: | Height: | Size: 468 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_139.jpg
Normal file
|
After Width: | Height: | Size: 567 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_14.jpg
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_140.jpg
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_141.jpg
Normal file
|
After Width: | Height: | Size: 536 B |
BIN
WS24_25/PyCharm/pythonProject/P3/numbers/img_142.jpg
Normal file
|
After Width: | Height: | Size: 532 B |