Write the following code today:
classChessrule {/**Pawn rules of movement*/ Public voidArmsrule (intMan,jlabel play,mouseevent me) { //Black Stroke down if(Man < 21){ //the coordinates that move down and get the end point are blurred into legal coordinates. if((Me.gety ()-play.gety ()) > && (me.gety ()-play.gety ()) < && (Me.getx ()-play.getx ()) < &A mp;& (Me.getx ()-play.getx ()) > 0){ //The current record is added to the collection (for undo)Var.add (string.valueof (Play.isvisible ())); Var.add (String.valueof (Play.getx ())); Var.add (String.valueof (Play.gety ())); Var.add (String.valueof (man)); Play.setbounds (Play.getx (), play.gety ()+57,55,55); } //move to the right, get the end of the coordinates blurred to the legal coordinates, must cross the river Else if(Play.gety () > 284 && (Me.getx ()-Play.getx ()) >= && (Me.getx ()-Play.getx ()) <= 112) {play.setbounds (Play.getx ()+57,play.gety (), 55,55); } //move to the left, get the end point of the coordinates blurred to the legal coordinates, must cross the river Else if(Play.gety () > 284 && (Play.getx ()-Me.getx ()) >= 2 && (Play.getx ()-Me.getx ()) <=58){ //Fuzzy coordinatesPlay.setbounds (Play.getx () -57,play.gety (), 55,55); } } //Red Stroke up Else{ //The current record is added to the collection (for undo)Var.add (string.valueof (Play.isvisible ())); Var.add (String.valueof (Play.getx ())); Var.add (String.valueof (Play.gety ())); Var.add (String.valueof (man)); //the coordinates that move up and get the end point are blurred to the legal coordinates if((Me.getx ()-play.getx ()) >= 0 && (Me.getx ()-play.getx ()) <= && (Play.gety ()-me.gety ()) >27 & amp;& play.gety ()-me.gety () < 86) {play.setbounds (Play.getx (), play.gety ()-57,55,55); } //move to the right, get the end of the coordinates blurred to the legal coordinates, must cross the river Else if(Play.gety () <= 341 && (Me.getx ()-Play.getx ()) >= && (Me.getx ()-Play.getx ()) <= 112) {play.setbounds (Play.getx ()+57,play.gety (), 55,55); } //move to the left, get the end point of the coordinates blurred to the legal coordinates, must cross the river Else if(Play.gety () <= 341 && (Play.getx ()-Me.getx ()) >= 3 && (Play.getx ()-Me.getx ()) <=58) {play.setbounds (Play.getx ()-57,play.gety (), 55,55); } } }//End of stroke movement /**rules of chess for stroke*/ Public voidarmsrule (JLabel play1,jlabel play2) {//go right. if((Play2.getx ()-Play1.getx ()) <= && (Play2.getx ()-Play1.getx ()) >= && (Play1.gety ()-Play 2.getY ()) < && (Play1.gety ()-play2.gety ()) > -22 && play2.isvisible () && play1.getname ( ). CharAt (1)!=play2.getname (). CharAt (1)){ //black moves across the river to eat chess right . if(Play1.getname (). charAt (1) = = ' 1 ' && play1.gety () > 284 && play1.getname (). charAt (1)! = Play2.getname (). charAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } //Red is going to cross the river to eat chess on the left. Else if(Play1.getname (). charAt (1) = = ' 2 ' && play1.gety () < 341 && Play1.getname (). charAt (1)! = Play2.getname (). charAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } } //go left. Else if((Play1.getx ()-Play2.getx ()) <= && (Play1.getx ()-Play2.getx ()) >= && (Play1.gety ()-Play 2.getY ()) < && (Play1.gety ()-play2.gety ()) > -22 && play2.isvisible () && play1.getname ( ). CharAt (1)!=play2.getname (). CharAt (1)){ //black moves across the river to eat chess on the left. if(Play1.getname (). charAt (1) = = ' 1 ' && play1.gety () > 284 && play1.getname (). charAt (1)! = Play2.getname (). charAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } //red moves across the river to eat chess right . Else if(Play1.getname (). charAt (1) = = ' 2 ' && play1.gety () < 341 && Play1.getname (). charAt (1)! = Play2.getname (). charAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } } //go up. Else if(Play1.getx ()-Play2.getx () >= -22 && play1.getx ()-Play2.getx () <= $ && play1.gety ()-Play2.get Y () >= -112 && play1.gety ()-play2.gety () <= 112){ //Black chess can't eat up chess if(Play1.getname (). charAt (1) = = ' 1 ' && play1.gety () < Play2.gety () && play1.getname (). charAt (1)! = Play2.getname (). CharAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } //Red chess can't eat chess down Else if(Play1.getname (). charAt (1) = = ' 2 ' && play1.gety () > Play2.gety () && play1.getname (). charAt (1)! = Play2.getname (). CharAt (1) {play2.setvisible (false); //put each other's position to himselfPlay1.setbounds (Play2.getx (), Play2.gety (), 55,55); } } //The current record is added to the collection (for undo)Var.add (string.valueof (Play1.isvisible ())); Var.add (String.valueof (Play1.getx ())); Var.add (String.valueof (Play1.gety ())); Var.add (String.valueof (man)); //The current record is added to the collection (for undo)Var.add (string.valueof (Play2.isvisible ())); Var.add (String.valueof (Play2.getx ())); Var.add (String.valueof (Play2.gety ())); Var.add (string.valueof (i)); }//end of stroke 0
Job Seven: Team Project--alpha version Sprint stage-12