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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? knightstour.java~68~

?? 這是本科生的畢業設計
?? JAVA~68~
字號:
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 < 8 ;row ++){         for ( int column = 0 ; column < 8 ; 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}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男人的j进女人的j一区| 奇米色一区二区三区四区| 久久久久久久久久电影| 精品视频全国免费看| 欧美三级中文字幕在线观看| 一本大道久久a久久综合婷婷| 99久久综合狠狠综合久久| 高清成人免费视频| 99精品欧美一区二区三区小说| 99久久久无码国产精品| 色国产综合视频| 日韩欧美国产综合一区| 中文字幕不卡在线观看| 亚洲一区二区偷拍精品| 日本视频一区二区三区| 国产一区二区网址| 色乱码一区二区三区88| 欧美va亚洲va在线观看蝴蝶网| 久久精品一区二区| 亚洲一区在线观看免费观看电影高清| 麻豆精品视频在线观看视频| 成人禁用看黄a在线| 欧美一区二区日韩| 亚洲欧美电影一区二区| 国产高清无密码一区二区三区| 色婷婷国产精品| 久久久久国产精品免费免费搜索| 亚洲欧美日韩人成在线播放| 国产一区二区三区不卡在线观看 | 成人欧美一区二区三区白人| 亚洲欧美日韩电影| 成人性生交大片免费看中文| 69堂成人精品免费视频| 中文字幕在线视频一区| 久久精品国产网站| 91精品黄色片免费大全| 天天综合日日夜夜精品| 欧美日韩一区二区电影| 一级中文字幕一区二区| yourporn久久国产精品| 亚洲国产精品黑人久久久| 激情综合色综合久久| 欧美一区二区女人| 欧美aaaaaa午夜精品| 精品视频1区2区3区| 亚洲国产成人tv| 色综合久久天天| 亚洲图片欧美色图| 在线一区二区三区| 午夜精品久久久久久久久久久| 欧美日韩一区高清| 蜜臀精品久久久久久蜜臀| 欧美电视剧免费全集观看| 毛片基地黄久久久久久天堂| 日韩午夜精品视频| 国产高清在线精品| 中文字幕一区二区三区乱码在线| 99精品视频在线观看免费| 亚洲欧美日韩国产中文在线| 欧美日韩色综合| 另类综合日韩欧美亚洲| 国产精品午夜春色av| 欧美伊人精品成人久久综合97 | 欧美高清一级片在线| 午夜精品久久一牛影视| 2023国产精品| www.亚洲色图| 久久99热这里只有精品| 国产精品水嫩水嫩| 欧美日产在线观看| 国产传媒久久文化传媒| 夜夜嗨av一区二区三区中文字幕| 欧美一区二区三区四区久久| 不卡欧美aaaaa| 免费高清视频精品| 亚洲精选视频免费看| 精品奇米国产一区二区三区| 在线免费av一区| 成人午夜视频在线观看| 老色鬼精品视频在线观看播放| **欧美大码日韩| 久久久美女艺术照精彩视频福利播放| 色88888久久久久久影院野外| 韩国av一区二区| 免费欧美在线视频| 亚洲一区二区在线免费看| 国产欧美一区二区精品婷婷| 日韩欧美中文一区二区| 欧美最猛黑人xxxxx猛交| 不卡一区二区三区四区| 国内精品伊人久久久久av一坑| 免费在线观看成人| 蜜乳av一区二区| 午夜在线电影亚洲一区| 亚洲国产一区二区a毛片| 成人欧美一区二区三区1314| 中文字幕欧美国产| 久久久不卡网国产精品一区| 精品裸体舞一区二区三区| 6080国产精品一区二区| 日韩一区二区三| www国产精品av| 国产精品网站在线| 国产精品视频一二三区 | 最新国产精品久久精品| 国产色产综合色产在线视频| 中文字幕免费不卡| 亚洲欧美日韩久久| 日韩精品一二三四| 久久不见久久见免费视频7| 国内一区二区在线| av一区二区三区四区| 欧美亚洲国产bt| 日韩女优视频免费观看| 日本一区二区三区久久久久久久久不| 久久综合色之久久综合| 国产精品成人一区二区三区夜夜夜| 国产精品视频免费看| 午夜精品成人在线视频| 高清国产午夜精品久久久久久| 在线免费一区三区| 日韩无一区二区| 国产精品美女视频| 伦理电影国产精品| 91香蕉视频污| 337p日本欧洲亚洲大胆色噜噜| 国产精品久久久久久久久动漫| 污片在线观看一区二区 | 91官网在线观看| 欧美日韩久久久一区| 国产精品人人做人人爽人人添| 日本aⅴ免费视频一区二区三区| eeuss影院一区二区三区| 精品少妇一区二区| 午夜视频在线观看一区二区| 成人a级免费电影| 欧美精品一区二区久久久| 一区二区三区**美女毛片| 成人精品免费看| 久久久久久免费| 老司机精品视频导航| 欧美日韩第一区日日骚| 亚洲欧美一区二区三区孕妇| 国产99精品国产| 欧美激情一区二区| 国产精品538一区二区在线| 日韩欧美一级特黄在线播放| 亚洲.国产.中文慕字在线| 色哟哟一区二区三区| 亚洲免费观看高清完整版在线| aaa亚洲精品一二三区| 亚洲素人一区二区| 色94色欧美sute亚洲线路一久| 亚洲女性喷水在线观看一区| 99热99精品| 亚洲视频一二区| 91视频国产观看| 亚洲国产精品影院| 6080yy午夜一二三区久久| 另类综合日韩欧美亚洲| 精品日本一线二线三线不卡| 国产成人亚洲综合a∨婷婷 | 国产精品高清亚洲| 不卡电影免费在线播放一区| 亚洲欧美日韩在线| 欧美猛男超大videosgay| 天天综合网 天天综合色| 日韩欧美高清在线| 99re这里只有精品6| 日韩主播视频在线| 中文字幕av一区二区三区| 在线一区二区三区四区五区| 精品一区二区在线免费观看| 中文字幕亚洲区| 91精品国产色综合久久| 极品少妇一区二区三区精品视频 | 在线亚洲欧美专区二区| 热久久国产精品| 亚洲综合色噜噜狠狠| 国产欧美一区二区三区在线看蜜臀| 不卡免费追剧大全电视剧网站| 一区二区三区四区不卡在线| 日韩欧美国产精品| 91啦中文在线观看| 国产一区不卡精品| 五月天一区二区| 亚洲蜜臀av乱码久久精品| 欧美国产成人精品| 日韩欧美精品三级| 717成人午夜免费福利电影| 色婷婷激情综合| 91在线视频官网| 成人手机在线视频| 国产.欧美.日韩| 免费在线观看一区二区三区| 亚洲成人午夜电影| 午夜精品久久一牛影视| 亚洲国产中文字幕在线视频综合 | 国产精品久久久久影院色老大| 欧美一级国产精品|