-
Notifications
You must be signed in to change notification settings - Fork 0
/
controllershifumi.java
75 lines (57 loc) · 2.1 KB
/
controllershifumi.java
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package sample;
import javafx.fxml.FXML;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
public class controllershifumi {
int a;
int b;
int c;
@FXML
private Label winner;
@FXML
private Button zero;
@FXML
private Button one;
@FXML
private Label scoreme;
@FXML
private Label scoreordi;
@FXML
private Button two;
@FXML
public void proc(ActionEvent event) {
a =(int)(Math.random()*3);
if (event.getSource() == zero && a == 2){
b = Integer.parseInt(scoreme.getText());
b++;
scoreme.setText(String.valueOf(b));
}else if (event.getSource() == two && a == 1){
b = Integer.parseInt(scoreme.getText());
b++;
scoreme.setText(String.valueOf(b));
}else if (event.getSource() == one && a == 0){
int b = Integer.parseInt(scoreme.getText());
b++;
scoreme.setText(String.valueOf(b));
}else if (event.getSource() == two && a == 0){
c = Integer.parseInt(scoreordi.getText());
c++;
scoreordi.setText(String.valueOf(c));
}else if (event.getSource() == one && a == 2){
c = Integer.parseInt(scoreordi.getText());
c++;
scoreordi.setText(String.valueOf(c));
}else if (event.getSource() == zero && a == 1){
c = Integer.parseInt(scoreordi.getText());
c++;
scoreordi.setText(String.valueOf(c));
}else if ((Integer.parseInt(scoreordi.getText())) == (Integer.parseInt(scoreme.getText()))){
winner.setText("Votre Score Est égale à Celui de l'Ordinateur");
}else if ((Integer.parseInt(scoreordi.getText()))>(Integer.parseInt(scoreme.getText()))){
winner.setText("L'ordinateur a Gagné");
}else if ((Integer.parseInt(scoreme.getText()))>(Integer.parseInt(scoreordi.getText()))){
winner.setText("Vous Avez Gagné");
}
}
}