Job Seven: Team Project--alpha version Sprint stage-12

Source: Internet
Author: User
Tags gety

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.