亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? knightstour.java~67~

?? Java課程設(shè)計(jì)案例精編光盤源碼
?? JAVA~67~
字號(hào):
package gao;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.awt.image.*;public class KnightsTour extends JApplet {   public static int access[][] = {      {2,3,4,4,4,4,3,2},      {3,4,6,6,6,6,4,3},      {4,6,8,8,8,8,6,4},      {4,6,8,8,8,8,6,4},      {4,6,8,8,8,8,6,4},      {4,6,8,8,8,8,6,4},      {3,4,6,6,6,6,4,3},      {2,3,4,4,4,4,3,2}};   public static int accessbak[][] = arrayCopy ( access ) ;   // the value indicate the No.value moving   int countMoving = -1 ;   int tourXpos [] = new int [ 64 ];   int tourYpos [] = new int [ 64 ];   private int recordXpos [][];   private int recordYpos [][];   private int recordCount = - 1 ;   private int startx ;   private int starty ;   private boolean success = false;   MyPanel myPanel ;   public void tour ( int xpos ,int ypos ){//      int x,y;      countMoving ++ ;      //all the  64 squares has been touch , return      if (countMoving == 63 )      {         tourXpos [ countMoving ] = xpos ;         tourYpos [ countMoving ] = ypos ;//         if ( ( ( Math.abs( xpos -startx ) == 1)  & ( Math.abs ( ypos - starty ) ==2 ) ) |  //            ( ( Math.abs( xpos -startx ) == 2)  & ( Math.abs ( ypos - starty ) ==1 ) ) )         success = true ;         countMoving -- ;         return ;      }      AccessibleSquares nextSquare = new AccessibleSquares( xpos, ypos );      while (nextSquare.hasMoreAccessible())      {         // do moving         nextSquare.domoving();         //record this moving         tourXpos [ countMoving ] = xpos ;         tourYpos [ countMoving ] = ypos ;         // try the next moving         nextSquare.nextAccessible();         tour ( nextSquare.getXpos() , nextSquare.getYpos() );         //all the  64 squares has been touch , return         if ( success )         {            countMoving -- ;            return ;         }         //this moving try is a faillure, pick it up from the chess board         nextSquare.undomoving();      }// end of while      countMoving -- ;   }//end of tour method   public static int[] arrayCopy ( int array1[] )   {     int[]array2 = new int [array1.length];     for ( int row = 0 ; row < array1.length ; row ++ )     {          array2 [ row ] = array1  [ row ] ;     };     return array2;   }   public static int[][] arrayCopy ( int array1[][]  )   {      int[][] array2 = new int [array1.length][array1[0].length];     for ( int row = 0 ; row < array1.length ; row ++ )     {        for ( int column = 0 ; column < array1[0].length ; column ++ )        {          array2 [ row ][ column ] = array1  [ row ][ column ];        };     };     return array2;   }   public void initialArray ( int chessBoard[][]  )   {     for ( int row = 0 ; row < 8 ; row ++ )     {        for ( int column = 0 ; column < 8 ; column ++ )        {          chessBoard [ row ][ column ] = 0 ;        };     };   }/*   public static void main( String args[] ) {      KnightsTour application = new KnightsTour();      application.tour( 0 , 0 );   }*/   public void init () {      recordCount = -1 ;      recordXpos = new int [ 64 ][ 64 ] ;      recordYpos = new int [ 64 ][ 64 ] ;      for (int row = 0 ; row < 1 ;row ++){         for ( int column = 0 ; column < 1 ; column ++ ){            success = false ;            countMoving = -1;            startx = row ;            starty = column ;            access = arrayCopy ( accessbak );            tour ( row ,column );            recordCount ++ ;            recordXpos [ recordCount ] = arrayCopy ( tourXpos ) ;            recordYpos [ recordCount ] = arrayCopy ( tourYpos ) ;         }      }      recordCount = 0 ;      myPanel = new MyPanel( recordXpos [ 0 ] ,recordYpos [ 0 ]) ;      JPanel buttonPanel = new JPanel();      JButton nextMoving = new JButton( "Next Moving" );      JButton nextTour = new JButton( "Next Tour" );      buttonPanel.add( nextTour );      buttonPanel.add( nextMoving );      getContentPane().add( buttonPanel, BorderLayout.SOUTH );      getContentPane().add( myPanel );      nextMoving.addActionListener(         //anonymous inner class         new ActionListener() {            public void actionPerformed ( ActionEvent e ) {               myPanel.showNext() ;            }         }         );//end call to addActionListener         nextTour.addActionListener(            //anonymous inner class            new ActionListener() {               public void actionPerformed ( ActionEvent e ) {                  if ( recordCount < recordXpos.length - 1 ) {                     recordCount ++ ;                  } else {                     recordCount = 0 ;                  }                  myPanel.initboard ( recordXpos [ recordCount ] , recordYpos [ recordCount ] );                  myPanel.repaint();               }            }            );//end call to addActionListener   }   public void paint (Graphics g )   {      super.paint( g );/*      success = false ;      countMoving = -1;      access = arrayCopy ( accessbak );      tour ( 7 , 6 );      for ( int row = 0 ; row < 9 ; row ++ )      {         g.drawLine( 10 , 10 + 32 * row , 32 * 8 + 10 , 10 + 32 * row  );      }      for ( int column = 0 ; column < 9 ; column ++ )      {         g.drawLine( 10 + 32 * column , 10  , 10 + 32 * column , 32 * 8 + 10 );      };      for ( int count = 0 ; count < tourXpos.length ; count ++ )      {         g.drawString("" + count , 26 + 32 * tourXpos[ count ] ,32 + 32 * tourYpos [ count ] );      };*/   }}//end of class KnightsTourclass AccessibleSquares {   private static int horizontal[] = {2,1,-1,-2,-2,-1,1,2};   private static int vertical  [] = {-1,-2,-2,-1,1,2,2,1};   private int xpos[] ;   private int ypos[] ;   private int accessibility [];   private int ownxpos ,ownypos ;   private int ownAccessibility ;   private int arrayPos ;   private int countAccessibility;   public AccessibleSquares(int x , int y ){      int testXPos;      int testYPos;      xpos = new int [ 8 ];      ypos = new int [ 8 ];      accessibility = new int [ 8 ];      arrayPos = 0 ;      ownxpos = x ;      ownypos = y ;      ownAccessibility = KnightsTour.access[ x ][ y ];      for (int i = 0 ; i < horizontal.length ; i++ ){         testXPos = x + horizontal[ i ];         testYPos = y + vertical  [ i ];         if ( (testXPos >= 0 ) & ( testXPos < 8 ) &              (testYPos >= 0 ) & ( testYPos < 8 ) ) {            xpos [ arrayPos ] = testXPos ;            ypos [ arrayPos ] = testYPos ;            accessibility [ arrayPos ] = KnightsTour.access [testXPos][testYPos];            //because  accessibility [ arrayPos ] = 0 indicating the square has been occupied            if (accessibility [ arrayPos ] > 0 )               arrayPos ++ ;         }//end of if      }// end of for      countAccessibility = arrayPos ;      if (countAccessibility > 0 )         {sortAll();}      arrayPos = -1 ;   }// end of constructor   public boolean hasMoreAccessible(){      // arrayPos + 1 point to the next accessible      if ( (arrayPos + 1 ) < countAccessibility ){         return true;      }else {         return false;      }   }//end of the hasMoreAccessible()   public AccessibleSquares nextAccessible(){      arrayPos ++ ;      return this;   }   public AccessibleSquares accessibleAt( int pos){      if ((pos >= 0) & (pos < countAccessibility ))      arrayPos = pos ;      return this;   }   public int getXpos(){      return xpos[ arrayPos ];   }   public int getYpos(){      return ypos[ arrayPos ];   }   public int getAccessibility(){      return accessibility[ arrayPos ];   }   public int getTotalAccessible(){      return countAccessibility;   }   //bubble sorting   private void sortAll (){      for ( int begin = 0 ; begin < countAccessibility - 1 ; begin ++ ){         for ( int i = begin + 1; i < countAccessibility ; i ++ ){            if ( accessibility [ begin ] > accessibility [ i ] ){               swapAll( begin, i );            }//end of if         }// end of inner for      }// end of outer for   }// end of sortAll   private void swapAll ( int i , int j ){      int temp ;      temp = xpos [ i ];      xpos [ i ] = xpos [ j ];      xpos [ j ] = temp;      temp = ypos [ i ];      ypos [ i ] = ypos [ j ];      ypos [ j ] = temp;      temp = accessibility [ i ];      accessibility [ i ] = accessibility [ j ];      accessibility [ j ] = temp;   }   public void domoving(){      for ( int i = 0 ; i < countAccessibility ; i ++ ){         KnightsTour.access[ xpos [i] ][ ypos[i] ] -- ;      }       KnightsTour.access[ ownxpos ][ ownypos ] = 0 ;   }   public void undomoving(){      for ( int i = 0 ; i < countAccessibility ; i ++ ){         KnightsTour.access[ xpos [i] ][ ypos[i] ] ++ ;      }      KnightsTour.access[ ownxpos ][ ownypos ] = ownAccessibility ;   }}class MyPanel extends JPanel {   public static final int WHITE = 0 ;   public static final int BLACK = 1 ;   public static final int WKNIGHT = 2 ;   public static final int BKNIGHT = 3 ;   private int chessboard[][];   private int xrecord [] ;   private int yrecord [] ;   private int displayCount ;   private int lastxpos ,lastypos ,nextxpos ,nextypos ;   ImageIcon images[] ;   private boolean start ;   public MyPanel() {      initvariance();   }   public MyPanel( int [] newxrecord ,int [] newyrecord ) {      initvariance();      initboard( newxrecord , newyrecord );   }   public void initvariance () {      chessboard = new int[ 8 ][ 8 ];      xrecord = new int [ 64 ] ;      yrecord = new int [ 64 ];      images = new ImageIcon [ 4 ];      images[ 0 ] = new ImageIcon( "white.jpg");      images[ 1 ] = new ImageIcon( "black.jpg");      images[ 2 ] = new ImageIcon( "wknight.jpg");      images[ 3 ] = new ImageIcon( "bknight.jpg");   }   public void initboard ( int [] newxrecord ,int [] newyrecord ){      start = true ;      displayCount = -1 ;      for (int row = 0 ; row < 8 ;row ++){         for ( int column = 0 ; column < 8 ; column ++ ){            // white use 0 ,black use 1            chessboard [ row ][ column ] = ( row + column ) % 2 ;         }      }//end of outer for      for ( int row = 0 ; row < newxrecord .length ; row ++ ) {         xrecord [ row ] = newxrecord [ row ] ;         yrecord [ row ] = newyrecord [ row ] ;      }      displayCount = 0 ;      chessboard [ xrecord [ displayCount ] ][ yrecord [ displayCount ] ] += 2 ;   }//end of initboard   public void showNext() {      if ( displayCount < xrecord.length - 1 ){         displayCount ++ ;         chessboard [ xrecord [ displayCount ] ][ yrecord [ displayCount ] ] += 2 ;         repaint();      }   }   public void paintComponent ( Graphics g ) {      for (int row = 0 ; row < 8 ;row ++){         for ( int column = 0 ; column < 8 ; column ++ ){            images[ chessboard[ row ][ column ] ].paintIcon( this , g, 40 * row,40 * column );         }//end of inner for      }//end of outer for      if ( displayCount > 0 ){         lastxpos = xrecord [ displayCount  - 1];         lastypos = yrecord [ displayCount  - 1];         nextxpos = xrecord [ displayCount ];         nextypos = yrecord [ displayCount ];         g.setColor( Color.green);         g.drawRect( 40 * xrecord [ displayCount - 1 ] + 2,40 * yrecord [ displayCount - 1 ] + 2, 36, 36 );         g.setColor( Color.green);         g.drawRect( 40 * xrecord [ displayCount ] + 2 ,40 * yrecord [ displayCount ] + 2, 36, 36 );         g.setColor( Color.blue);         g.drawRect( 40 * Math.min( nextxpos, lastxpos ),            40 * Math.min( nextypos, lastypos ),            ( Math.abs( nextxpos - lastxpos ) + 1 ) * 40,            ( Math.abs( nextypos - lastypos ) + 1 ) * 40 );      }//end of if      g.setColor( Color.red );      g.drawRect ( 40 * xrecord [ 0 ] + 2,40 * yrecord [ 0 ] + 2, 36, 36 ) ;   }// end of the method paintComponent}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲影院理伦片| 亚洲一区二区三区四区五区黄| 久久综合色之久久综合| 亚洲精品在线观| 国产精品乱人伦中文| 一区二区三区欧美久久| 免费久久99精品国产| 国产成人亚洲综合色影视| 欧美做爰猛烈大尺度电影无法无天| 欧美高清视频一二三区| 国产精品日韩精品欧美在线| 日韩精品乱码av一区二区| 国产成人8x视频一区二区| 欧美精品精品一区| 国产精品久久久一区麻豆最新章节| 亚洲夂夂婷婷色拍ww47| 国产很黄免费观看久久| 欧美视频一区二| 亚洲欧美日韩成人高清在线一区| 免费观看成人鲁鲁鲁鲁鲁视频| 成人精品一区二区三区四区| 337p亚洲精品色噜噜| 日韩毛片高清在线播放| 国产成人自拍网| 久久久天堂av| 精品无码三级在线观看视频| 91精品国产欧美一区二区18| 亚洲黄色av一区| 日本高清免费不卡视频| 国产精品久久影院| 色偷偷一区二区三区| 亚洲女与黑人做爰| 欧美曰成人黄网| 五月天久久比比资源色| 欧美午夜不卡在线观看免费| 亚洲精品福利视频网站| 欧美日韩激情一区| 午夜电影久久久| 日韩一区二区麻豆国产| 国产一区二区在线看| 久久精品在线观看| 成人v精品蜜桃久久一区| 亚洲色图视频免费播放| 欧美美女一区二区| 国产在线不卡一区| 亚洲人成精品久久久久| 欧美日韩一级二级三级| 国产麻豆精品在线观看| 亚洲美女视频在线观看| 91精品久久久久久久久99蜜臂| 国产一区在线看| 一区二区三区四区视频精品免费 | 在线视频你懂得一区二区三区| 亚洲高清中文字幕| 日本一区二区视频在线| 欧美疯狂做受xxxx富婆| 波多野结衣中文字幕一区| 亚洲成a人片综合在线| 久久看人人爽人人| 欧美猛男男办公室激情| 国产91精品欧美| 免费人成在线不卡| 亚洲综合色网站| 中文字幕一区在线观看| 久久久不卡影院| 久久婷婷综合激情| 精品成人一区二区三区四区| 欧美在线短视频| 欧洲另类一二三四区| 99re成人精品视频| 成人99免费视频| 成人一级片在线观看| 福利一区二区在线| 国产成人自拍网| 粉嫩绯色av一区二区在线观看| 国产一区视频网站| 成人免费不卡视频| 99久久夜色精品国产网站| 99国产精品99久久久久久| 99久久国产综合精品麻豆| 91色porny在线视频| 欧美在线观看视频一区二区三区| 欧美性一级生活| 日韩一区二区三区在线| 欧美r级在线观看| 中文字幕成人av| 一区二区免费在线| 日本vs亚洲vs韩国一区三区| 韩国成人在线视频| 成人看片黄a免费看在线| 欧美日韩国产影片| 久久久精品tv| 亚洲自拍偷拍图区| 国内精品伊人久久久久av一坑| 大白屁股一区二区视频| 91精品国产入口| 国产精品久久久久三级| 亚洲福利一二三区| 精品综合久久久久久8888| 成人av电影在线网| 2024国产精品| 亚洲成人av一区二区| 成人免费精品视频| 久久综合久久鬼色中文字| 亚洲精品视频在线观看免费| 精品中文字幕一区二区| 欧洲另类一二三四区| 亚洲女厕所小便bbb| 丁香亚洲综合激情啪啪综合| 欧美一区三区四区| 日韩高清一区在线| 91国偷自产一区二区三区成为亚洲经典 | 亚洲人成网站影音先锋播放| 精品一区二区三区视频在线观看| 欧美系列日韩一区| 午夜天堂影视香蕉久久| 91激情在线视频| 亚洲综合在线电影| 91在线视频免费观看| 五月婷婷另类国产| 91精品国产色综合久久久蜜香臀| 亚洲国产欧美另类丝袜| 91成人免费在线| 亚洲精品菠萝久久久久久久| 色综合久久久久综合99| 一区二区三区四区视频精品免费 | 欧美日韩在线观看一区二区| 亚洲一区二区精品久久av| 欧美性大战xxxxx久久久| 亚洲一区在线观看视频| 欧美一区二区三区爱爱| 久久99国产精品成人| 国产精品视频免费| 欧美综合亚洲图片综合区| 亚洲第一主播视频| 欧美v亚洲v综合ⅴ国产v| 国产91精品一区二区麻豆亚洲| 亚洲婷婷在线视频| 日韩一区二区三区精品视频| 国产一区二区影院| 亚洲三级小视频| 精品国产乱码久久久久久1区2区| 国内国产精品久久| 一区二区在线观看视频在线观看| 一本色道久久综合亚洲91| 香蕉久久一区二区不卡无毒影院| 日韩精品一区二区三区中文精品| 国产激情91久久精品导航| 一区2区3区在线看| 精品久久久影院| 欧美午夜精品理论片a级按摩| 奇米精品一区二区三区在线观看一| 国产亚洲污的网站| 日韩一区二区在线观看视频| 91麻豆swag| 成人免费三级在线| 国内精品第一页| 午夜精品久久久久久久久| 久久久不卡影院| 日韩区在线观看| 欧美精品欧美精品系列| 日本韩国欧美一区| 一本久久a久久精品亚洲| voyeur盗摄精品| 色综合久久久久久久久久久| 成人午夜电影小说| 大陆成人av片| 99精品黄色片免费大全| 91麻豆成人久久精品二区三区| www.亚洲免费av| 成年人午夜久久久| 色婷婷av一区二区三区软件| 色综合久久精品| 日本韩国一区二区| 欧美日韩一区精品| 日韩手机在线导航| 精品国产91乱码一区二区三区| 日韩欧美的一区| 国产精品色呦呦| 国产精品国产三级国产普通话三级 | 91精品国产色综合久久久蜜香臀| 欧美日韩综合在线免费观看| 欧美日韩另类一区| 欧美精品 国产精品| 精品少妇一区二区三区 | 国产精品中文字幕日韩精品| 国内一区二区在线| 一本色道a无线码一区v| 欧美一区二区免费视频| 国产女同互慰高潮91漫画| 亚洲黄网站在线观看| 国产一区二区久久| 色婷婷久久久综合中文字幕| 日韩欧美自拍偷拍| 亚洲最新视频在线观看| 国产一区二区主播在线| 91精品国产综合久久久蜜臀图片| 国产精品欧美久久久久一区二区| 九色|91porny| 欧美精品1区2区3区|