Skip to content

Quidditch #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions Answers/40230212079/.idea/.gitignore

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

11 changes: 11 additions & 0 deletions Answers/40230212079/.idea/40230212079.iml

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

6 changes: 6 additions & 0 deletions Answers/40230212079/.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/40230212079/.idea/modules.xml

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

6 changes: 6 additions & 0 deletions Answers/40230212079/.idea/vcs.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/40230212079/Beater.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.* ;
class Beater extends Player {
public String beaterisSuccessful(){
String v = isSuccessful(0.4);
return v;
}
}
7 changes: 7 additions & 0 deletions Answers/40230212079/Chaser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.* ;
class Chaser extends Player {
public String chaserisSuccessful(){
String v = isSuccessful(0.3);
return v;
}
}
File renamed without changes.
7 changes: 7 additions & 0 deletions Answers/40230212079/Keeper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.* ;
class Keeper extends Player {
public String keeperisSuccessful(){
String v = isSuccessful(0.7);
return v;
}
}
40 changes: 40 additions & 0 deletions Answers/40230212079/Match.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import java.util.* ;
public class Match {
String result ;
int count = 1;
int scoreteam1 =0 ;
int scoreteam2 =0 ;
public String start(){
while (count <101){
Team myobj = new Team() ;
scoreteam1 = myobj.play(scoreteam1) ;
if (scoreteam1 == 150){
break ;
}
scoreteam2 = myobj.play(scoreteam2) ;
if (scoreteam2 == 150){
break ;
}
count ++ ;
}
System.out.println("scoreteam1 = " + scoreteam1);
System.out.println("scoreteam2 = " + scoreteam2);

if(scoreteam1 > scoreteam2 ){
result = "team1 won";
}
else if(scoreteam1 < scoreteam2 ){
result = "team2 won";
}
else if(scoreteam1 == scoreteam2 ){
result = "draw";
}
else if(scoreteam2==150){
result = "team2 won";
}
else if(scoreteam1==150){
result = "team1 won";
}
return result ;
}
}
7 changes: 7 additions & 0 deletions Answers/40230212079/MyApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.* ;
public class MyApp {
public static void main(String[] args){
Match myObj = new Match() ;
System.out.println(myObj.start());
}
}
11 changes: 11 additions & 0 deletions Answers/40230212079/Player.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.* ;
class Player implements Success {
public String isSuccessful(double z) {
if(((double) Math.random()) > z){
return "t" ;
}
else {
return "f" ;
}
}
}
1 change: 1 addition & 0 deletions Answers/40230212079/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is file for Quidditch
7 changes: 7 additions & 0 deletions Answers/40230212079/Seeker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.* ;
class Seeker extends Player {
public String seekerisSuccessful(){
String v = isSuccessful(0.5);
return v;
}
}
4 changes: 4 additions & 0 deletions Answers/40230212079/Success.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import java.util.* ;
interface Success {
public String isSuccessful(double z) ;
}
38 changes: 38 additions & 0 deletions Answers/40230212079/Team.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import java.util.* ;
public class Team {
String Keeper , Seeker , Beater1 , Beater2 , Chaser1 , Chaser2 , Chaser3 ;
int b = 0 ;
int Goal = 0 ;
private void setGoal(int Goal){
Goal = Goal + 1;
}
public int play(int y ) {
Beater myobj = new Beater();
Chaser MyOBj = new Chaser();
Keeper myOBj = new Keeper();
Seeker myoBj = new Seeker();
Beater1 = myobj.beaterisSuccessful();
Beater2 = myobj.beaterisSuccessful();
Chaser1 = MyOBj.chaserisSuccessful();
Chaser2 = MyOBj.chaserisSuccessful();
Chaser3 = MyOBj.chaserisSuccessful();
Keeper = myOBj.keeperisSuccessful();
Seeker = myoBj.seekerisSuccessful() ;
Goal = y ;
int callsetGoal = 0 ;
if(Seeker =="t"){
Goal=150 ;
}
else if(Keeper == "t"){
callsetGoal++ ;
} else if ((Beater1 == "t") || (Beater2 == "t")) {
callsetGoal++ ;
} else if ((Chaser1 == "t" && Chaser2 =="t")||(Chaser1 =="t" && Chaser3 =="t")||(Chaser2 =="t" && Chaser3 =="t")) {
callsetGoal++ ;
}
if(callsetGoal == 3){
setGoal(Goal) ;
}
return Goal ;
}
}

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

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

6 changes: 6 additions & 0 deletions Answers/40230212079/out/production/40230212079/.idea/misc.xml

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

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

6 changes: 6 additions & 0 deletions Answers/40230212079/out/production/40230212079/.idea/vcs.xml

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

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bring your project in this folder
commit each changes of your project.
at the end, send a pull request to orginal repo.
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.