-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuman.java
More file actions
57 lines (50 loc) · 1.32 KB
/
Human.java
File metadata and controls
57 lines (50 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.io.*;
import java.util.*;
/**
* Human ist die Klasse für einen menschlichen Spieler
*
* @author Götz und Dominik
* @version 9.11
*/
public class Human extends Player
{
public Human()
{
}
public void set_name(){
Out.println("Spieler: ");
Out.println("Bitte geben Sie ihren Namen ein");
this.name = In.readWord();
Out.println("");
}
public String word_input()
{
System.out.println(this.get_name() + ", bitte geben Sie ein Wort ein: ");
String word = In.readWord();
word = word.toUpperCase();
if (word.equals("PENIS"))
{
Out.println("");
Out.println("Sorry, dein 'Wort' ist zu kurz!");
Out.println("");
this.sleep(2);
}
return word;
}
public String guess()
{
System.out.println(this.get_name() + ", bitte geben Sie einen Buchstaben ein: ");
String chr = In.readWord();
chr = chr.toUpperCase();
return chr;
}
public void sleep(int seconds)
{
int milli_seconds = 1000 * seconds;
try {
Thread.sleep(milli_seconds);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
}