1 UEC UEC http://www.tnlab.ice.uec.ac.jp/daihinmin/ 20061028
1 4 2 6 2.1.......................... 6 2.1.1.............................. 6 2.1.2......................... 6 2.1.3........................... 7 2.1.4..................... 7 2.1.5..................... 8 2.2............................ 8 2.2.1.............................. 8 2.2.2....... 8 3 10 3.1 1......................... 10 3.1.1......... 11 3.1.2............... 11 3.1.3.......................... 12 3.1.4............... 12 3.2 2................. 12 4 UEC 13 4.1............................. 13 4.1.1.......................... 13 4.1.2........................ 13 4.1.3.......................... 13 4.2............................. 14 4.2.1............................... 14 4.2.2.......................... 14 4.2.3.......................... 14 4.2.4........................... 14 4.2.5............................. 15 1
4.2.6 ( )..................... 15 4.2.7 ( )........................... 15 4.2.8............................... 15 4.2.9............................... 16 4.3.................... 16 4.3.1........................... 16 4.3.2 3.......................... 17 4.3.3 8 ( )................. 17 4.4.............................. 17 4.4.1 8.............................. 17 4.4.2.............................. 18 4.5......................... 18 4.5.1 ( )................... 18 4.5.2.............................. 18 4.6......................... 19 5 20 5.1................................. 20 5.2 Cygwin Windows........... 21 5.2.1 Cygwin.................... 21 5.2.2.......... 22 5.3 knoppix........................... 25 5.3.1...................... 25 5.3.2......................... 25 6 30 6.1............................... 30 6.1.1 cygwin.......................... 30 6.1.2 knoppix......................... 30 6.2................... 32 6.2.1 Cygwin....................... 32 6.2.2 knoppix....................... 33 6.3............... 33 6.4.............. 33 6.4.1 (Cygwin )...................... 34 6.4.2 (knoppix )..................... 34 6.4.3......................... 35 6.5.......................... 36 6.5.1 Cygwin......................... 36 2
6.5.2 knoppix......................... 36 6.6..................... 37 7 38 7.1................................... 38 7.2.............................. 38 7.3................................. 39 7.3.1.......................... 39 7.3.2......................... 40 7.3.3...................... 43 7.4................................. 43 7.4.1........................... 43 7.4.2............................... 44 7.5?...................... 45 8 46 8.1..................... 46 8.2............................ 47 8.3................................. 47 9 49 9.1.............................. 49 9.2............................ 50 9.3.............................. 51 9.3.1 scope type........................... 51 9.3.2 state type............................ 51 9.4................................. 52 9.4.1 daihinmin.c........................... 52 9.4.2 connection.c........................... 54 9.5.................................. 55 10 57 10.1 F AQ........................... 57 10.1.1..................... 57 10.1.2...................... 58 10.2.............................. 59 11 61 3
1 1960 5 2 5 5 6 11 18 UEC 4
UEC 1 UEC 11 18 UEC! 5
2 1 UEC 2.1 100 2.1.1 2.1.2 1. 5 (5 ) 2. 1 ( 2.3 ) 3. 100 6
4. 5. 5 1 100 2.1.3 100 1 100 30 2.1.4 1 1 5 2 4 3 3 4 2 5 1 100 500 100 7
2.1.5 1 2 100 5 5 100 2.2 2.2.1 2.2.2 Web 8
5 1 1. 5 2. 1 ( 2.3 ) 3. 4. 1 2 5. 9
3 UEC 1. 2. 3.1 1 1. knoppix CD Linux ( ) 2. Windows cygwin 3. FreeBSD,Solaris,Linux 1. 2,3 1. Windows cygwin(http://www.cygwin.com) (2. ) 2. (http://www.tnlab.ice.uec.ac.jp/daihinmin/) 3. (.tar.gz ) 4. 10
5. 2 1 1 3.1.1 UEC Web (http://www.tnlab.ice.uec.ac.jp/daihinmin/) ( ) ( 8 ) ( ) 3.1.2 Web (8, ) 11
3.1.3 6 3.1.4 ( ) UEC 11 12 daihinmin@ice.uec.ac.jp 3.2 2 UEC ( ) 2 UEC 1 12
4 UEC 1 UEC 1 UEC UEC 2006 UEC 2006 4.1 4.1.1 52 1 53 4.1.2 2 4.1.3 3 2 ( ) 3 13
4.2 3 3 4.2.1 ( ) 4.2.2 3 3 4.2.3 3 4 5 1 4.2.4 14
4.2.5 2 8 3 4.2.6 ( ) 4.2.7 ( ) 3 9 10 5-6-7 8-9-10 ( ) 4.2.8 3 2 4 3 15
4 5 4.2.9 1 2 2 1 3 4 1 5 2 1. 2. 3. 4. 4.3 4.3.1 2 3 9 2 9 3 16
( ) ( ) ( ) 9 ( 3 ) 4.3.2 3 3 3 1 ( ) 3 3 3 3 3 4.3.3 8 ( ) 8 8 8 8 8 4.4 4.4.1 8 8 8 ( ) 8 8 8 8 17
4.4.2 4 6 7 7 9 9 2 9 9 4.5 4.5.1 ( ) 1. 2. 20 4.5.2 ( ) 18
2.8Ghz Pentium4 UltraSparcIII Cu Solaris8 4.6 daihinmin@ice.uec.ac.jp 19
5 C Java C 5.1 Solaris FreeBSD Linux OS Cygwin Windows Windows Cygwin Cygwin Windows Linux Linux Cygwin Linux knoppix knoppix 1CD Linux Linux CD-ROM DVD knoppix knoppix CD DVD DVD DVD daihinmin@ice.uec.ac.jp CD Cygwin knoppix 20
5.2 Cygwin Windows Cygwin Windows 5.2.1 Cygwin Cygwin Cygwin Cygwin http://www.cygwin.com/ 5.1 Install or update now! 5.1: Cygwin (http://www.cygwin.com/) 5.2 5.3 URL.jp 21
?? Install Cygwin Devel X11 5.4! 5.2.2 UEC Web ( http://www.tnlab.ice.uec.ac.jp/daihinmin/ ) 5.6.tar.gz Windows.tar.gz LhaForge Lhaplus daihinmin (C:) cygwin home home Administrator 5.7 6 22
5.2: 5.3: 5.4: 5.5: 23
5.6: 5.7: daihinmin 24
5.3 knoppix 5.3.1 1. DVD-R 1 (100 ) 2. 64MB USB (2000 ) 3. ( PC ) 4. ( ) knoppix 5.3.2 DVD-R 1 USB? OK! knoppix knoppix (Internet Exproler Firefox ) http://unit.aist.go.jp/itri/knoppix/ ( 5.8 ) ( CD )CD[iso ] ( 5.9 ) (?? ) knoppix v5.0.1dvd( ).iso knoppix ( 5.11 ) DVD-R knoppix ( 5.12 ) 25
5.8: knoppix 5.9: CD[iso ] 26
5.10: 5.11: 27
UEC (http://www.tnlab.ice.uec.ac.jp/daihinmin/) USB knoppix DVD PC PC knoppix DVD DVD DVD PC DVD DVD PC knoppix knoppix USB PC 6 28
5.12: DVD 29
6 6.1 cygwin knoppix 6.1.1 cygwin cygwin terapad 6.1.2 knoppix knoppix USB 30
USB knoppix DVD USB 5 USB 6.1 6.1: OK ( 6.2 ) 6.2: USB USB KDE knoppix USB USB /media/sda1 tar xvzf 31
( 20061018 20061020 20061018 20061020 ) $cd /media/sda1 $tar xzvf tndhm_devkit20061018.tar.gz $ daihinmin 6.2 6.2.1 Cygwin 5 daihinmin client client.c ( ) ( 6.2.1) 6.3: client.c client 9 32
6.2.2 knoppix {USB }/daihinmin/client/ ( ) emacs $cd /media/sda1/daihinmin/client $emacs client.c & $ emacs emacs web emacs 6.3 README.txt client ( ) $./configure $make clean $make 6.4 knoppix knoppix CD DVD DVD DVD 33
daihinmin@ice.uec.ac.jp CD Cygwin knoppix 6.4.1 (Cygwin ) Cygwin 6.4.1 6.4: $cd ~/daihinmin/server $./configure $cd src $make clean $make 6.4.2 (knoppix ) OK 34
$cd /media/sda1/daihinmin/server $./configure $make clean $make $ daihinmin@ice.uec.ac.jp $./configure $make clean $make INSTALL.txt 6.4.3 Cygwin cygwin.exe $startxwin.sh 6.5 6.5: 35
$cd ~/daihinmin/server/src $./tndhms.exe & 8 knoppix $cd /media/sda1/daihinmin/server/src $./tndhms & 8 6.5 6.5.1 Cygwin $cd ~/daihinmin/client $./client.exe 127.0.0.1 & 5 2 5 5 6.5.2 knoppix $cd /media/sda1/daihinmin/client $./client 127.0.0.1 & 36
5 5 5 6.6 9 7 37
7 7.1 socket 7.2 8x15 ( ) UEC 7.1 7.1: 1 1 JOKER 2 Yes or No 1 Yes 0 No 38
7.3 7.3.1?? socket 7.2: 39
1 2 3 ( ) 4 5 6 5 7 8 7.3.2 7.2 1 2 [5][1] 1 2 3 8 1 7 8 4 5 6 C table 1; while( ){ 2; 40
} if(table[5][1]>0){ 3; } while( 8 1 ){ if( ){ 4; 5; 6; } 7; 8; } daihinmin@ice.uec.ac.jp 1: socket 0 4! 2: [5][1] 3: 2 41
4: 4 7 4 7 [5][2] 1 4 5: 4 1 0 2 0 6: 5 5 9 8 8 7: 42
1 0 (5 ) 4 8: 1 5 4 7.3.3 0 4 7.4 7.4.1 2 43
? [4][1] 2 [4][1] 2!!? [0][0] [3][14] 2 0? 2 OK 9 10 9 10 11 [0][7] [0][8] 1 [0][9] 2 0 5 5 4 [0][3] [1][3] [2][3] 1 [3][3] 2 0 OK daihinmin@ice.uec.ac.jp 7.4.2 0 ( ) 44
0 7.5? OK 45
8 8.1 5 1 1. 2. 2 3. 2 4. 1 5. 1 46
6. 4 (a) (b) (c) (d) (e) (f) (g) (h) (i) 7. 1 8.2 configure xmkmf INSTALL.txt 8.3 src tndfgs 8.1 1. 2. 3. 4. 5. 6. 47
7. 1 8.1: 48
9 9.1 client.c daihinmin.c daihinmin.h connection.c connection.h selection.c client.c change.c client.c client.c client.c 1. (entrytogame()) 2. (starttrick()) 3. 1 2 (change.c) 4. (receivecards()) 49
5. (selection.c) 6. (sendcards()) 7. 4 8. 2 9. (closesocket) 9.2 int g logging struct state type state client.c main int my playernum; int whole gameend flag=0; int one gameend flag=0; int accept flag; int own cards buf[8][15]; int own cards[8][15]; int ba cards buf[8][15]; int ba cards[8][15]; int table count=0; int game count=0; int new game flag=1; char server name[16]; daihinmin static int order[15] connection static int g sockfd static int g writer len static int g new sockfd static int g buf len static struct sockaddr in g reader addr static struct sockaddr in g writer addr static struct sockaddr in g client addr 1 IP daihinmin.c connection.c 50
9.3 daihinmin.h 2 9.3.1 scope type scope type struct scope_type { int loword; int highord; int maxqty; int minqty; int sequence; }; 1 0 9.3.2 state type state type struct state_type { int ord; int sequence; 1 0 int qty; int rev; 1 0 int b11; 11 1 0 int lock; 1 0 int onset; 1 0 int suit[5]; suit[i] 1 i int joker; Joker 1 0 }; 51
9.4 9.4.1 daihinmin.c struct scope type setscope(int low,int high,int min,int max,int sequence) scope type struct scope type defaultscope() scope type void getstate(int cards[8][15]) cards state type state void getfield(int cards[8][15]) cards state type state void showstate(void) state void showscope(struct scope type scope) scope struct scope type setscope(int low,int high,int min,int max,int sequence) scope type struct scope type defaultscope() scope type void setscopeloword(struct scope type* scope,int val) scope type loword void setscopehighord(struct scope type* scope,int val) scope type highord void setscopeminqty(struct scope type* scope,int val) scope type minqty void setscopemaxqty(struct scope type* scope,int val) scope type maxqty 52
void setscopesequence(struct scope type* scope,int val) scope type sequence void cardssieve(int cards[8][15],struct scope type scope) scope cards void cardssievetuple(int cards[8][15],struct scope type scp) cardssieve void cardssievesequence(int cards[8][15],struct scope type scp) cardssieve void setorder(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int) (selectcards ) order[] selectcards void setorderdefault(void) order void selectcards(int cards[8][15]) cards order state cards cards state void cardsor(int cards1[8][15],int cards2[8][15]) cards2 cards1 void cardsand(int cards1[8][15],int cards2[8][15]) cards1 cards2 cards1 void cardsdiff(int cards1[8][15],int cards2[8][15]) cards1 cards2 void cardsnot(int cards[8][15]) cards cards void outputtable(int table[8][15]) void copytable(int org table[8][15],int dest table[8][15]) org table dest table 53
void copycards(int org cards[8][15],int dest cards[8][15]) org cards dest cards copytable void clearcards(int cards[8][15]) cards 0 int beemptycards(int cards[8][15]) cards 0 1 9.4.2 connection.c int entrytogame(char* host) host int starttrick(int table[8][15]) void sendchangingcards(int cards[8][15]) int receivecards(int cards[8][15]) 1 int sendcards(int cards[8][15]) void lookfield(int cards[8][15]) int begameend(void) 1 int refreshtable(int table val[8][15]) 0-1 54
int sendtable(int table val[8][15]) 0-1 int opensocket(char ip addr[], int portnum data) 0-1 int closesocket() close 0-1 9.5 cards1 1 1 1 1 1 1 cards1: 1 1 1 1 1 copycards(cards1,cards2); cards1 cards2 scope setscopeloword(scope,1); setscopehighord(scope,13); setscopeminqty(scope,3); setscopemaxqty(scope,10); setscopesequence(scope,1); 1 13 ( 3,4,,K,A,2) 3 10 cardssieve(cards2,scope); cards2 cards2: 1 1 1 1 1 1 cards1 cards2 cardsdiff(cards1,cards2); cards1 cards2 55
1 1 1 cards1: 1 1 selectcards(cards1); selectcards(cards2); order state cards1 cards2 56
10 FAQ 10.1 F AQ 10.1.1? 1 100 100 100? 10 57
10.1.2?? 4 ( ) 3 3 3? 3 3 OK? 58
4-5-6 7-8-9? 2 3? 3 3 3 3? 3 3 3 10.2 (knoppix) 59
Web daihinmin@ice.uec.ac.jp 24 60
11 UEC UEC 11 18 UEC 20061028 2006 10 28 2 4 3! 10 FAQ 20061021 2006 10 21 2 4 5 cygwin 6 cygwin 9 61
20061018 2006 10 18 3 4 6 knoppix DVD knoppix 7 JOKER 20061016 2006 10 16 11 20061015 2006 10 15 5 1 2 3 3.2 4 4.3.1 11 20061014 2006 10 14 3 62