First Necessary Commit

Erster Push, um das Repository einzurichten
This commit is contained in:
Justin Dretvic 2020-05-10 14:30:39 +02:00
parent 10d9b97d92
commit b07c82dfe6
16 changed files with 307 additions and 0 deletions

BIN
Hangman.jar Normal file

Binary file not shown.

10
Hangman/.classpath Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-14.0.1">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
Hangman/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Hangman</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,58 @@
package HangmanPackage;
import java.util.Scanner;
public class Game {
public static void startGame() {
// Variablen & Stuff
Scanner s = new Scanner(System.in);
System.out.print("Player 2: Schau kurz weg! \nPlayer 1: Gib dein Wort (als Klein-Buchstaben) an, drück 'ENTER' und pass die Fenstergröße an: ");
String wort = s.nextLine();
char[] ausgabe = new char[wort.length()];
int versuche = 10;
boolean win = false;
boolean pruefer = true;
// Game-Grundeinstellung
Methoden.leerzeile(20);
Methoden.ersteAusgabe(wort, ausgabe);
Strichmaennchen.create();
//////////////////////// G A M E /////////////////////////////
while( versuche > 0 && !win) {
System.out.print("Die nächste Spielereingabe: ");
String eingabe = s.nextLine();
char raten = eingabe.charAt(0);
pruefer = Methoden.checkWord(wort,raten,ausgabe,eingabe);
if(pruefer == false)
versuche -- ;
Methoden.leerzeile(20);
Strichmaennchen.draw(versuche);
System.out.println("restliche Versuche: " + versuche);
win = Methoden.checkWin(ausgabe,wort);
Methoden.zweiteAusgabe(ausgabe, wort);
}
Methoden.printWin(win);
s.close();
}
}

View File

@ -0,0 +1,11 @@
package HangmanPackage;
public class Main {
public static void main(String[] args) {
Game.startGame();
}
}

View File

@ -0,0 +1,63 @@
package HangmanPackage;
public class Methoden {
public static void ersteAusgabe(String a, char[] meep) {
for (int i = 0; i < a.length() ; i++) {
meep[i] = '_';
System.out.print(meep[i] + " ");
}
System.out.println(" ");
}
public static void zweiteAusgabe(char[] a, String b) {
for (int i=0; i < b.length() ; i++) {
System.out.print(a[i] + " ");
}
System.out.println(" ");
}
public static void leerzeile(int a) {
for(int i=0; i< a; i++) {
System.out.println(" ");
}
}
public static boolean checkWord(String wort,char raten,char[] ausgabe,String eingabe) {
boolean check = false;
for (int i = 0; i < wort.length();i++) {
if(raten == wort.charAt(i)) {
ausgabe[i] = raten;
check = true;
}
}
return check;
}
public static boolean checkWin(char[] a,String b) {
for(int w = 0 ; w < b.length() ; w++) {
if(a[w] == (b.charAt(w))) {
if(w == b.length()-1) {
return true;
}
} else {
return false;
}
}
return false;
}
public static void printWin(boolean b) {
System.out.println(" ");
if(b==true) {
System.out.println("You've W O N !");
Trophy.draw();
} else {
System.out.println("You've L O S T !");
}
}
//String st = String.valueOf(wort.charAt(u));
//if(raten.equals(st)) {
}

View File

@ -0,0 +1,93 @@
package HangmanPackage;
public class Strichmaennchen {
public static char[][] galgen = new char[25][11]; // 25 x 11
public static void drop() {
System.out.println(galgen[0][0]);
}
public static void create() {
for(int x=0 ; x < galgen.length ; x++ ) {
for(int y=0 ; y < galgen[x].length ; y++ ) {
galgen[x][y]=' ';
}
}
}
public static void draw(int fail) {
if(fail==0||fail==1||fail==2||fail==3||fail==4||fail==5||fail==6||fail==7||fail==8||fail==9) {
galgen[9][8] ='H';
galgen[10][8]='A';
galgen[11][8]='N';
galgen[12][8]='G';
galgen[13][8]='M';
galgen[14][8]='A';
galgen[15][8]='N';
for(int y=6;y<=10;y=y+4) {
for(int x=1;x<=23;x++) {
galgen[x][y]='-';
}
}
for(int x=0;x<=24;x=x+24) {
for(int y=7;y<=9;y++) {
galgen[x][y]='|';
}
}
galgen[0][6] ='+';
galgen[0][10] ='+';
galgen[24][6] ='+';
galgen[24][10]='+';
}
if (fail==0||fail==1||fail==2||fail==3||fail==4||fail==5||fail==6||fail==7||fail==8) {
for(int i=0;i<=4;i++) {
galgen[11][1+i]='|';
}
galgen[11][0]='+';
}
if (fail==0||fail==1||fail==2||fail==3||fail==4||fail==5||fail==6||fail==7) {
for(int i=0;i<=3;i++) {
galgen[12+i][0]='-';
}
galgen[15][0]='+';
}
if (fail==0||fail==1||fail==2||fail==3||fail==4||fail==5||fail==6) {
galgen[15][1]='|';
}
if (fail==0||fail==1||fail==2||fail==3||fail==4||fail==5) {
galgen[15][2]='O';
}
if (fail==0||fail==1||fail==2||fail==3||fail==4) {
galgen[15][3]='|';
}
if (fail==0||fail==1||fail==2||fail==3) {
galgen[14][3]='/';
}
if (fail==0||fail==1||fail==2) {
galgen[16][3]='\\';
}
if (fail==0||fail==1) {
galgen[14][4]='/';
}
if (fail==0) {
galgen[16][4]='\\';
}
/*for(int x=0 ; x<galgen.length ; x++) {
for(int y=0; y<galgen[x].length ; y++) {
System.out.print(galgen[y][x]);
}
System.out.println(" ");
}*/
for(int y=0 ; y<galgen[y].length ; y++) {
for(int x=0; x<galgen.length ; x++) {
System.out.print(galgen[x][y]);
}
System.out.println(" ");
}
}
}

View File

@ -0,0 +1,27 @@
package HangmanPackage;
public class Trophy {
static char[][] trophy = new char[][]{
{' ',' ',' ',' ',' ','_','_','_','_','_','_','_','_','_','_','_',' ',' ',' ',' '},
{' ',' ',' ',' ','(','_','_','_','_','_','_','_','_','_','_','_',')',' ',' ',' '},
{' ',' ',' ',' ','|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ','|','|',' ',' ',' '} ,
{' ','/','/','=','|','|',' ','{','{',' ','1',' ','}','}',' ','|','|','=','\\','\\'} ,
{'|','|',' ',' ','|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ','|','|',' ',' ','|','|'} ,
{' ','\\','\\','=','|','|',' ',' ',' ',' ','O',' ',' ',' ',' ','|','|','=','/','/'},
{' ',' ',' ',' ','|','|',' ',' ',' ','\\','|','/',' ',' ',' ','|','|',' ',' ',' '},
{' ',' ',' ',' ','\\','\\',' ',' ',' ','/',' ','\\',' ',' ',' ','/','/',' ',' ',' '},
{' ',' ',' ',' ',' ','\\','\\','_','_','_','_','_','_','_','/','/',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ',' ','_',')',' ',' ',' ','(','_',' ',' ',' ',' ',' ',' '},
{' ',' ',' ',' ',' ',' ','/','_','_','_','_','_','_','_','\\',' ',' ',' ',' ',' '},
};
public static void draw() {
for(int x=0 ; x<trophy.length ; x++) {
for(int y=0; y<trophy[x].length ; y++) {
System.out.print(trophy[x][y]);
}
System.out.println(" ");
}
}
}

5
README.txt Normal file
View File

@ -0,0 +1,5 @@
################# HOW TO USE ##################
# 1) open cmd #
# 2) type in: java -jar filepath\Sudoku.jar #
# 3) enjoy #
###############################################

8
todo.txt Normal file
View File

@ -0,0 +1,8 @@
(X) Eingabe annehmen
(X) Eingabe überprüfen
(X) Versuchsanzahl vorgeben
(X) Hangman zeichnen
( ) Wörterbuch einrichten
( ) Computer als Gegner einrichten
( ) Anleitung einführen
( ) GUI einrichten