Kunstig Intelligens til Brætspillet Taiji - Danmarks Tekniske Universitet

Kunstig Intelligens til Brætspillet Taiji - Danmarks Tekniske Universitet Kunstig Intelligens til Brætspillet Taiji - Danmarks Tekniske Universitet

09.09.2013 Views

224 Bilag A 501 System . out . p r i n t l n (” t P r i n t PrintNode ”+n+” Depth : ”+n . d+” Score ”+n . a+” par ”+n . par+” w ”+n . wc+”,”+n . wr+” b ”+n . bc+”,”+n . br+” c h i l d r e n : ”+n . c h i l d r e n ) ; 502 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 0 ] + ” ”+n . nodeBoard [ 1 ] [ 0 ] + ” ”+n . nodeBoard [ 2 ] [ 0 ] + ” ”+n . nodeBoard [ 3 ] [ 0 ] + ” ”+ n . nodeBoard [ 4 ] [ 0 ] + ” ”+n . nodeBoard [ 5 ] [ 0 ] + ” ”+n . nodeBoard [ 6 ] [ 0 ] + ” ”+n . nodeBoard [ 7 ] [ 0 ] + ” ”+n . nodeBoard [ 8 ] [ 0 ] ) ; 503 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 1 ] + ” ”+n . nodeBoard [ 1 ] [ 1 ] + ” ”+n . nodeBoard [ 2 ] [ 1 ] + ” ”+n . nodeBoard [ 3 ] [ 1 ] + ” ”+ n . nodeBoard [ 4 ] [ 1 ] + ” ”+n . nodeBoard [ 5 ] [ 1 ] + ” ”+n . nodeBoard [ 6 ] [ 1 ] + ” ”+n . nodeBoard [ 7 ] [ 1 ] + ” ”+n . nodeBoard [ 8 ] [ 1 ] ) ; 504 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 2 ] + ” ”+n . nodeBoard [ 1 ] [ 2 ] + ” ”+n . nodeBoard [ 2 ] [ 2 ] + ” ”+n . nodeBoard [ 3 ] [ 2 ] + ” ”+ n . nodeBoard [ 4 ] [ 2 ] + ” ”+n . nodeBoard [ 5 ] [ 2 ] + ” ”+n . nodeBoard [ 6 ] [ 2 ] + ” ”+n . nodeBoard [ 7 ] [ 2 ] + ” ”+n . nodeBoard [ 8 ] [ 2 ] ) ; 505 i f ( tModel . noRows > 3) { 506 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 3 ] + ” ”+n . nodeBoard [ 1 ] [ 3 ] + ” ”+n . nodeBoard [ 2 ] [ 3 ] + ” ”+n . nodeBoard [ 3 ] [ 3 ] + ” ”+n . nodeBoard [ 4 ] [ 3 ] + ” ”+n . nodeBoard [ 5 ] [ 3 ] + ” ”+n . nodeBoard [ 6 ] [ 3 ] + ” ”+n . nodeBoard [ 7 ] [ 3 ] + ” ”+n . nodeBoard [ 8 ] [ 3 ] ) ; 507 i f ( tModel . noRows > 4) { 508 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 4 ] + ” ”+n . nodeBoard [ 1 ] [ 4 ] + ” ”+n . nodeBoard [ 2 ] [ 4 ] + ” ”+n . nodeBoard [ 3 ] [ 4 ] + ” ”+n . nodeBoard [ 4 ] [ 4 ] + ” ”+n . nodeBoard [ 5 ] [ 4 ] + ” ”+n . nodeBoard [ 6 ] [ 4 ] + ” ”+n . nodeBoard [ 7 ] [ 4 ] + ” ”+n . nodeBoard [ 8 ] [ 4 ] ) ; 509 i f ( tModel . noRows > 5) { 510 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 5 ] + ” ”+n . nodeBoard [ 1 ] [ 5 ] + ” ”+n . nodeBoard [ 2 ] [ 5 ] + ” ”+n . nodeBoard [ 3 ] [ 5 ] + ” ”+n . nodeBoard [ 4 ] [ 5 ] + ” ”+ n . nodeBoard [ 5 ] [ 5 ] + ” ”+n . nodeBoard [ 6 ] [ 5 ] + ” ”+n . nodeBoard [ 7 ] [ 5 ] + ” ”+n . nodeBoard [ 8 ] [ 5 ] ) ; 511 i f ( tModel . noRows > 6) { 512 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 6 ] + ” ”+n . nodeBoard [ 1 ] [ 6 ] + ” ”+n . nodeBoard [ 2 ] [ 6 ] + ” ”+n . nodeBoard [ 3 ] [ 6 ] + ” ”+n . nodeBoard [ 4 ] [ 6 ] + ” ”+n . nodeBoard [ 5 ] [ 6 ] + ” ”+n . nodeBoard [ 6 ] [ 6 ] + ” ”+n . nodeBoard [ 7 ] [ 6 ] + ” ”+n . nodeBoard [ 8 ] [ 6 ] ) ; 513 i f ( tModel . noRows > 7) { 514 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 7 ] + ” ”+n . nodeBoard [ 1 ] [ 7 ] + ” ”+n . nodeBoard [ 2 ] [ 7 ] + ” ”+n . nodeBoard [ 3 ] [ 7 ] + ” ”+n . nodeBoard [ 4 ] [ 7 ] + ” ”+n . nodeBoard [ 5 ] [ 7 ] + ” ”+n . nodeBoard [ 6 ] [ 7 ] + ” ”+n . nodeBoard [ 7 ] [ 7 ] + ” ”+n . nodeBoard [ 8 ] [ 7 ] ) ; 515 i f ( tModel . noRows > 8) { 516 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 8 ] + ” ”+n . nodeBoard [ 1 ] [ 8 ] + ” ”+n . nodeBoard [ 2 ] [ 8 ] + ” ”+n . nodeBoard [ 3 ] [ 8 ] + ” ”+n . nodeBoard [ 4 ] [ 8 ] + ” ”+n . nodeBoard [ 5 ] [ 8 ] + ” ”+n . nodeBoard [ 6 ] [ 8 ] + ” ”+n .

A.16 TaijiSettings.java 225 517 518 519 } 520 } 521 } 522 } 523 } 524 } 525 System . out . p r i n t l n ( ) ; 526 } 527 } A.16 TaijiSettings.java nodeBoard [ 7 ] [ 8 ] + ” ”+n . nodeBoard [ 8 ] [ 8 ] ) ; 1 import java . awt . event . ∗ ; 2 import javax . swing . ∗ ; 3 import java . awt . ∗ ; 4 5 p u b l i c c l a s s T a i j i S e t t i n g s extends JDialog { 6 // S e l v e d i a l o g e n s panel . 7 p r i v a t e JPanel mainPanel = new JPanel ( ) ; 8 9 // Radiobuttons t i l at v a e l g e AI og andre s e t t i n g s . 10 p r i v a t e JRadioButton oneButton = new JRadioButton (” Player VS Player ”) ; 11 p r i v a t e JRadioButton twoButton = new JRadioButton (” Player VS LocalArea ”) ; 12 p r i v a t e JRadioButton threeButton = new JRadioButton (” Player VS AlphaBeta ”) ; 13 p r i v a t e JRadioButton fourButton = new JRadioButton (” Player VS Growth ”) ; 14 p r i v a t e JRadioButton f i v e B u t t o n = new JRadioButton (” LocalArea VS Player ”) ; 15 p r i v a t e JRadioButton sixButton = new JRadioButton (” AlphaBeta VS Player ”) ; 16 p r i v a t e JRadioButton sevenButton = new JRadioButton (” Growth VS Player ”) ; 17 p r i v a t e ButtonGroup group = new ButtonGroup ( ) ; 18 19 //To knapper som godkende e l l e r a f v i s e r det a n t a l b l o c k s som e r v a l g t . 20 p r i v a t e JButton okButton = new JButton (”Ok”) ; 21 p r i v a t e JButton cancelButton = new JButton (” Cancel ”) ; 22 23 p r i v a t e TaijiFrame tFrame ; 24 25 // Constructor . 26 // Modtager en AtaxxFrame som argument . 27 p u b l i c T a i j i S e t t i n g s ( TaijiFrame frame ) 28 { 29 super ( frame , ” T a i j i s e t t i n g s ” , t r u e ) ;

224 Bilag A<br />

501 System . out . p r i n t l n (” t P r i n t PrintNode ”+n+” Depth : ”+n . d+”<br />

Score ”+n . a+” par ”+n . par+” w ”+n . wc+”,”+n . wr+” b ”+n .<br />

bc+”,”+n . br+” c h i l d r e n : ”+n . c h i l d r e n ) ;<br />

502 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 0 ] + ” ”+n . nodeBoard<br />

[ 1 ] [ 0 ] + ” ”+n . nodeBoard [ 2 ] [ 0 ] + ” ”+n . nodeBoard [ 3 ] [ 0 ] + ” ”+<br />

n . nodeBoard [ 4 ] [ 0 ] + ” ”+n . nodeBoard [ 5 ] [ 0 ] + ” ”+n . nodeBoard<br />

[ 6 ] [ 0 ] + ” ”+n . nodeBoard [ 7 ] [ 0 ] + ” ”+n . nodeBoard [ 8 ] [ 0 ] ) ;<br />

503 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 1 ] + ” ”+n . nodeBoard<br />

[ 1 ] [ 1 ] + ” ”+n . nodeBoard [ 2 ] [ 1 ] + ” ”+n . nodeBoard [ 3 ] [ 1 ] + ” ”+<br />

n . nodeBoard [ 4 ] [ 1 ] + ” ”+n . nodeBoard [ 5 ] [ 1 ] + ” ”+n . nodeBoard<br />

[ 6 ] [ 1 ] + ” ”+n . nodeBoard [ 7 ] [ 1 ] + ” ”+n . nodeBoard [ 8 ] [ 1 ] ) ;<br />

504 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 2 ] + ” ”+n . nodeBoard<br />

[ 1 ] [ 2 ] + ” ”+n . nodeBoard [ 2 ] [ 2 ] + ” ”+n . nodeBoard [ 3 ] [ 2 ] + ” ”+<br />

n . nodeBoard [ 4 ] [ 2 ] + ” ”+n . nodeBoard [ 5 ] [ 2 ] + ” ”+n . nodeBoard<br />

[ 6 ] [ 2 ] + ” ”+n . nodeBoard [ 7 ] [ 2 ] + ” ”+n . nodeBoard [ 8 ] [ 2 ] ) ;<br />

505 i f ( tModel . noRows > 3) {<br />

506 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 3 ] + ” ”+n . nodeBoard<br />

[ 1 ] [ 3 ] + ” ”+n . nodeBoard [ 2 ] [ 3 ] + ” ”+n . nodeBoard<br />

[ 3 ] [ 3 ] + ” ”+n . nodeBoard [ 4 ] [ 3 ] + ” ”+n . nodeBoard<br />

[ 5 ] [ 3 ] + ” ”+n . nodeBoard [ 6 ] [ 3 ] + ” ”+n . nodeBoard<br />

[ 7 ] [ 3 ] + ” ”+n . nodeBoard [ 8 ] [ 3 ] ) ;<br />

507 i f ( tModel . noRows > 4) {<br />

508 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 4 ] + ” ”+n .<br />

nodeBoard [ 1 ] [ 4 ] + ” ”+n . nodeBoard [ 2 ] [ 4 ] + ” ”+n .<br />

nodeBoard [ 3 ] [ 4 ] + ” ”+n . nodeBoard [ 4 ] [ 4 ] + ” ”+n .<br />

nodeBoard [ 5 ] [ 4 ] + ” ”+n . nodeBoard [ 6 ] [ 4 ] + ” ”+n .<br />

nodeBoard [ 7 ] [ 4 ] + ” ”+n . nodeBoard [ 8 ] [ 4 ] ) ;<br />

509 i f ( tModel . noRows > 5) {<br />

510 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 5 ] + ” ”+n .<br />

nodeBoard [ 1 ] [ 5 ] + ” ”+n . nodeBoard [ 2 ] [ 5 ] + ” ”+n<br />

. nodeBoard [ 3 ] [ 5 ] + ” ”+n . nodeBoard [ 4 ] [ 5 ] + ” ”+<br />

n . nodeBoard [ 5 ] [ 5 ] + ” ”+n . nodeBoard [ 6 ] [ 5 ] + ”<br />

”+n . nodeBoard [ 7 ] [ 5 ] + ” ”+n . nodeBoard [ 8 ] [ 5 ] ) ;<br />

511 i f ( tModel . noRows > 6) {<br />

512 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 6 ] + ” ”+n .<br />

nodeBoard [ 1 ] [ 6 ] + ” ”+n . nodeBoard [ 2 ] [ 6 ] + ”<br />

”+n . nodeBoard [ 3 ] [ 6 ] + ” ”+n . nodeBoard<br />

[ 4 ] [ 6 ] + ” ”+n . nodeBoard [ 5 ] [ 6 ] + ” ”+n .<br />

nodeBoard [ 6 ] [ 6 ] + ” ”+n . nodeBoard [ 7 ] [ 6 ] + ”<br />

”+n . nodeBoard [ 8 ] [ 6 ] ) ;<br />

513 i f ( tModel . noRows > 7) {<br />

514 System . out . p r i n t l n ( n . nodeBoard [ 0 ] [ 7 ] + ”<br />

”+n . nodeBoard [ 1 ] [ 7 ] + ” ”+n . nodeBoard<br />

[ 2 ] [ 7 ] + ” ”+n . nodeBoard [ 3 ] [ 7 ] + ” ”+n .<br />

nodeBoard [ 4 ] [ 7 ] + ” ”+n . nodeBoard<br />

[ 5 ] [ 7 ] + ” ”+n . nodeBoard [ 6 ] [ 7 ] + ” ”+n .<br />

nodeBoard [ 7 ] [ 7 ] + ” ”+n . nodeBoard<br />

[ 8 ] [ 7 ] ) ;<br />

515 i f ( tModel . noRows > 8) {<br />

516 System . out . p r i n t l n ( n . nodeBoard<br />

[ 0 ] [ 8 ] + ” ”+n . nodeBoard [ 1 ] [ 8 ] + ”<br />

”+n . nodeBoard [ 2 ] [ 8 ] + ” ”+n .<br />

nodeBoard [ 3 ] [ 8 ] + ” ”+n . nodeBoard<br />

[ 4 ] [ 8 ] + ” ”+n . nodeBoard [ 5 ] [ 8 ] + ”<br />

”+n . nodeBoard [ 6 ] [ 8 ] + ” ”+n .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!