Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
6 changes: 6 additions & 0 deletions Answers/40230212043/HarryPotter/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Answers/40230212043/HarryPotter/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Answers/40230212043/HarryPotter/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions Answers/40230212043/HarryPotter/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Answers/40230212043/HarryPotter/HarryPotter.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions Answers/40230212043/HarryPotter/src/Beater.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Random;
public class Beater extends Player {
public boolean isSuccessful() {
Random con=new Random();
int p=con.nextInt(100)+1;
if (p>=60) {
return true;
}
return false;
}
}
11 changes: 11 additions & 0 deletions Answers/40230212043/HarryPotter/src/Chaser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Random;
public class Chaser extends Player implements Success {
public boolean isSuccessful() {
Random con=new Random();
int p=con.nextInt(100)+1;
if (p>=70) {
return true;
}
return false;
}
}
11 changes: 11 additions & 0 deletions Answers/40230212043/HarryPotter/src/Keeper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Random;
public class Keeper extends Player implements Success {
public boolean isSuccessful() {
Random con = new Random();
int p = con.nextInt(100) + 1;
if (p >= 30) {
return true;
}
return false;
}
}
35 changes: 35 additions & 0 deletions Answers/40230212043/HarryPotter/src/Match.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
public class Match {
Team team1=new Team();
Team team2=new Team();
public void start() {
for (int i=0;i<=100;i++) {
team1.play();
team2.play();
if (team1.see.mov==true || team2.see.mov==true) {
break;
}
team1.see.mov=false;
team1.kee.mov=false;
team1.ch1.mov=false;
team1.ch2.mov=false;
team1.ch3.mov=false;
team1.be1.mov=false;
team1.be2.mov=false;
team2.see.mov=false;
team2.kee.mov=false;
team2.ch1.mov=false;
team2.ch2.mov=false;
team2.ch3.mov=false;
team2.be1.mov=false;
team2.be2.mov=false;
}
System.out.println("team1:"+team1.g+"\t"+"team2:"+team2.g);
if (team1.g> team2.g) {
System.out.print("winner: team1");
} else if (team2.g> team1.g) {
System.out.print("winner: team2");
} else {
System.out.print("mosavi!");
}
}
}
6 changes: 6 additions & 0 deletions Answers/40230212043/HarryPotter/src/Myapp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Myapp{
public static void main(String[] args) {
Match obj=new Match();
obj.start();
}
}
5 changes: 5 additions & 0 deletions Answers/40230212043/HarryPotter/src/Player.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class Player {
int nu;
String name;
boolean mov=false;
}
28 changes: 28 additions & 0 deletions Answers/40230212043/HarryPotter/src/Team.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
public class Team {
int g=0;
private void setGoal() {
g++;
}
Seeker see=new Seeker();
Keeper kee=new Keeper();
Chaser ch1=new Chaser();
Chaser ch2=new Chaser();
Chaser ch3=new Chaser();
Beater be1=new Beater();
Beater be2=new Beater();
public void play() {
see.mov=see.isSuccessful();
kee.mov=kee.isSuccessful();
ch1.mov=ch1.isSuccessful();
ch2.mov=ch2.isSuccessful();
ch3.mov=ch3.isSuccessful();
be1.mov=be1.isSuccessful();
be2.mov=be2.isSuccessful();
if (kee.mov==true || (be1.mov==true || be2.mov==true) || ((ch1.mov==true && ch2.mov==true) || (ch2.mov==true && ch3.mov==true) || (ch1.mov==true && ch3.mov==true))) {
setGoal();
}
if (see.mov==true) {
g+=150;
}
}
}
11 changes: 11 additions & 0 deletions Answers/40230212043/HarryPotter/src/seeker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Random;
public class Seeker extends Player implements Success {
public boolean isSuccessful() {
Random con=new Random();
int p=con.nextInt(100)+1;
if (p>=95) {
return true;
}
return false;
}
}
3 changes: 3 additions & 0 deletions Answers/40230212043/HarryPotter/src/success.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public interface Success {
public boolean isSuccessful();
}
2 changes: 2 additions & 0 deletions HarryPotter/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package PACKAGE_NAME;public class Main {
}