1 UEC UEC http://www.tnlab.ice.uec.ac.jp/daihinmin/ 20061016
1 4 2 6 2.1............................. 6 2.2............................... 6 2.3......................... 7 2.4......................... 7 3 8 3.1 1......................... 8 3.1.1......... 8 3.1.2............... 9 3.1.3.......................... 9 3.1.4............... 9 3.2 2................. 10 4 UEC 11 4.1............................. 11 4.1.1.......................... 11 4.1.2.......................... 11 4.2............................. 11 4.2.1............................... 12 4.2.2.......................... 12 4.2.3.......................... 12 4.2.4........................... 12 4.2.5............................. 12 4.2.6 ( )..................... 13 4.2.7 ( )........................... 13 4.2.8............................... 13 4.2.9............................... 13 4.3.................... 14 4.3.1........................... 14 1
4.3.2 3.......................... 14 4.3.3 8 ( )................. 14 4.4.............................. 14 4.4.1 8.............................. 14 4.4.2.............................. 15 4.5......................... 15 5 16 5.1................................. 16 5.2.......................... 16 5.3............................. 17 5.3.1 knoppix.................... 17 5.3.2........................ 17 5.3.3 knoppix CD PC.............. 17 6 19 6.1............................ 19 6.2.......................... 19 6.3............... 20 6.4.............. 20 6.4.1............................... 20 6.4.2......................... 20 6.4.3...................... 21 6.5..................... 21 7 22 7.1................................... 22 7.2.............................. 22 7.3................................... 23 7.3.1...................... 23 7.3.2......................... 23 7.4?...................... 24 8 25 8.1..................... 25 8.2............................ 26 8.3................................. 26 2
9 28 9.1.............................. 28 9.2............................ 29 9.3.............................. 30 9.3.1 scope type........................... 30 9.3.2 state type............................ 30 9.4................................. 31 9.4.1 daihinmin.c........................... 31 9.4.2 connection.c........................... 33 9.5.................................. 34 10 36 11 37 3
1 1960 2 5 5 6 11 18 UEC 4
UEC 1 UEC 11 18 UEC! 5
2 1 UEC 2.1 1. 5 (5 ) 2. 1 ( 2.3 ) 3. 100 4. 5. 5 1 100 2.2 100 1 100 30 6
2.3 1 1 5 2 4 3 3 4 2 5 1 100 500 100 2.4 1 2 100 5 5 100 7
3 UEC 1. 2. 3.1 1 2 1 1 3.1.1 UEC Web (http://www.tnlab.ice.uec.ac.jp/daihinmin/) ( ) ( 8 ) ( ) 8
3.1.2 Web (8, ) 3.1.3 6 3.1.4 ( ) UEC 9
11 17 daihinmin@ice.uec.ac.jp 3.2 2 UEC ( ) 2 UEC 1 10
4 UEC 1 UEC 1 UEC UEC 2006 UEC 2006 4.1 4.1.1 52 1 53 4.1.2 3 2 ( ) 3 4.2 3 3 11
4.2.1 ( ) 4.2.2 3 4.2.3 3 4 5 1 4.2.4 4.2.5 2 8 12
4.2.6 ( ) 4.2.7 ( ) 3 9 10 4.2.8 3 2 4 3 4 5 4.2.9 1 2 2 2 3 4 1 5 2 13
4.3 4.3.1 2 3 9 2 9 3 ( ) 4.3.2 3 3 3 1 ( ) 3 3 4.3.3 8 ( ) 8 8 8 8 8 4.4 4.4.1 8 8 8 ( ) 8 8 8 8 14
4.4.2 4 6 7 7 9 9 2 4.5 daihinmin@ice.uec.ac.jp 15
5 C Java C 5.1 OS Solaris FreeBSD Linux OS Linux knoppix knoppix 1CD Linux Linux CD-ROM knoppix 5.2 1. CD-R 1 (100 ) 2. 64MB USB (2000 ) 3. ( PC ) 16
4. ( ) knoppix 5.3 CD-R 1 USB? OK! 5.3.1 knoppix knoppix (Internet Exproler Firefox ) http://unit.aist.go.jp/itri/knoppix/ CD[iso ] CD-R knoppix 5.3.2 UEC (http://www.tnlab.ice.uec.ac.jp/daihinmin/) USB 5.3.3 knoppix CD PC PC knoppix CD CD CD PC CD-ROM 17
CD PC knoppix knoppix USB PC 18
6 6.1 KDE ( ) $cd /media/sda1 < > $tar xzvf tndhm_devkit.tar.gz < > $ server client 6.2 $cd client < > $emacs client.c & < > $ & emacs 19
11 17 daihinmin@ice.uec.ac.jp emacs emacs (google emacs ) 6.3 README.txt 6.4 6.4.1 OK $cd /media/sda1/daihinmin/server < > $./configure < > $make < > $ daihinmin@ice.uec.ac.jp INSTALL.txt 6.4.2 $cd /media/sda1/daihinmin/server/src < > $./tndhms < > 20
8 6.4.3 : 6.3 $cd /media/sda1/daihinmin/client < > $./client 127.0.0.1 < > 5 5 5 6.5 9 7 21
7 7.1 socket 7.2 8x15 ( ) 7.1: 1 1 Yes or No 1 Yes 0 No 22
7.3 7.3.1-1 -1 1 5 7.3.2 ( ) 2 23
1 ( ) 1 2 9 OK 1 7.4? OK 24
8 8.1 5 1 1. 2. 2 3. 2 4. 1 5. 1 25
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. 26
7. 1 8.1: 27
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()) 28
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 29
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 }; 30
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 31
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 32
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 33
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 34
1 1 1 cards1: 1 1 selectcards(cards1); selectcards(cards2); order state cards1 cards2 35
10 (knoppix) Web daihinmin@ice.uec.ac.jp 24 36
11 UEC UEC 11 18 UEC 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 37