Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/mty-makai/mty.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 203 by notanpe, Sat Aug 2 03:40:09 2008 UTC revision 204 by notanpe, Mon Aug 4 13:07:12 2008 UTC
# Line 67  uint64_t       pmask = 0; Line 67  uint64_t       pmask = 0;
67  unsigned char   umeStr[10];  unsigned char   umeStr[10];
68  int     umeLen;  int     umeLen;
69    
70  FILE    *tfp;  FILE    *nfp;   /* 全数 */
71    FILE    *tfp;   /* ↑以外の特殊検索 */
72    
73  unsigned int    seed;  unsigned int    seed;
74  int     verbose;  int     verbose;
# Line 105  int    special = 0; Line 106  int    special = 0;
106  #define ST_ALLN 1  #define ST_ALLN 1
107  #define ST_NIKO 1<<1  #define ST_NIKO 1<<1
108  #define ST_BUOO 1<<8  #define ST_BUOO 1<<8
109    #define ST_DOSU 1<<9
110    
111  void  void
112  comment( str )  comment( str )
# Line 116  char   *str; Line 118  char   *str;
118       case '0': special |= ST_ALLN; break;       case '0': special |= ST_ALLN; break;
119       case '1': special |= ST_NIKO; break;       case '1': special |= ST_NIKO; break;
120       case '8': special |= ST_BUOO; break;       case '8': special |= ST_BUOO; break;
121         case '9': special |= (ST_DOSU | ST_ALLN); break;
122      }      }
123     }     }
124    }    }
# Line 826  log_printf(FILE *ofp, char const *fmt, . Line 829  log_printf(FILE *ofp, char const *fmt, .
829    int r;    int r;
830    va_list ap;    va_list ap;
831    va_start(ap, fmt);    va_start(ap, fmt);
832    
833      /* MAKAI start */
834    #if 0
835      if ( ofp != nfp ) {
836       vfprintf(stdout, fmt, ap);
837      }
838    #endif /* 0 */
839      /* MAKAI end */
840    
841    vfprintf(stdout, fmt, ap);    vfprintf(stdout, fmt, ap);
842    r = vfprintf(ofp, fmt, ap);    r = vfprintf(ofp, fmt, ap);
843    va_end(ap);    va_end(ap);
# Line 1393  unsigned char  *kind; Line 1405  unsigned char  *kind;
1405    NONIKO:    NONIKO:
1406    
1407    if ( special & ST_ALLN ) {    if ( special & ST_ALLN ) {
1408     /* 全数字 */     /* 全数 か 怒数 */
1409     if ( isdigit( trip[0] ) && isdigit( trip[1] ) && isdigit( trip[2] ) &&     if ( isdigit( trip[0] ) && isdigit( trip[1] ) && isdigit( trip[2] ) &&
1410          isdigit( trip[3] ) && isdigit( trip[4] ) && isdigit( trip[5] ) &&          isdigit( trip[3] ) && isdigit( trip[4] ) && isdigit( trip[5] ) &&
1411          isdigit( trip[6] ) && isdigit( trip[7] ) && isdigit( trip[8] ) &&          isdigit( trip[6] ) && isdigit( trip[7] ) && isdigit( trip[8] ) &&
1412          isdigit( trip[9] ) ) {          isdigit( trip[9] ) ) {
1413      strcpy( kind, "数" );      if ( special & ST_DOSU ) {
1414      return( tfp );       /* 全数 & 回文 */
1415         if ( trip[0] == trip[9] && trip[1] == trip[8] && trip[2] == trip[7] &&
1416              trip[3] == trip[6] && trip[4] == trip[5] ) {
1417          strcpy( kind, "怒" );
1418          return( tfp );
1419         }
1420         /* 全数 & 双連 */
1421         if ( trip[0] == trip[1] && trip[2] == trip[3] && trip[4] == trip[5] &&
1422              trip[6] == trip[7] && trip[8] == trip[9] ) {
1423          strcpy( kind, "怒" );
1424          return( tfp );
1425         }
1426         /* 全数 & 山彦 */
1427         if ( trip[0] == trip[5] && trip[1] == trip[6] && trip[2] == trip[7] &&
1428              trip[3] == trip[8] && trip[4] == trip[9] ) {
1429          strcpy( kind, "怒" );
1430          return( tfp );
1431         }
1432         /* 最小ねらい */
1433         if ( trip[0] == '0' && trip[1] == '0' && trip[2] == '0' &&
1434              trip[3] == '0' && trip[4] == '0' && trip[5] == '0' &&
1435              trip[6] == '0' ) {
1436          strcpy( kind, "怒" );
1437          return( tfp );
1438         }
1439         /* 最大ねらい */
1440         if ( trip[0] == '9' && trip[1] == '9' && trip[2] == '9' &&
1441              trip[3] == '9' && trip[4] == '9' && trip[5] == '9' &&
1442              trip[6] == '9' ) {
1443          strcpy( kind, "怒" );
1444          return( tfp );
1445         }
1446        } else {
1447         strcpy( kind, "数" );
1448         return( nfp );
1449        }
1450     }     }
1451    }    }
1452    
# Line 1543  main(int argc, char *argv[]) Line 1590  main(int argc, char *argv[])
1590      usage( argv[0] );      usage( argv[0] );
1591      exit( 1 );      exit( 1 );
1592    }    }
   
   if ( verbose ) {  
    printf( "乱数の種 = %u\n", seed );  
   }  
1593  }  }
1594  /* MAKAI end */  /* MAKAI end */
1595    
# Line 1562  main(int argc, char *argv[]) Line 1605  main(int argc, char *argv[])
1605    root_expr = expr_parse("target.txt");    root_expr = expr_parse("target.txt");
1606    
1607  /* MAKAI start */  /* MAKAI start */
 /* here */  
1608    if ( verbose ) {    if ( verbose ) {
1609     printf( "特殊検索オプション : " );     printf( "特殊検索オプション : " );
1610     if ( special & ST_ALLN ) {     if ( special & ST_DOSU ) {
1611      printf( "全数 " );      printf( "怒数 " );
1612       } else {
1613        if ( special & ST_ALLN ) {
1614         printf( "全数 " );
1615        }
1616     }     }
1617     if ( special & ST_NIKO ) {     if ( special & ST_NIKO ) {
1618      printf( "二構 " );      printf( "二構 " );
# Line 1650  main(int argc, char *argv[]) Line 1696  main(int argc, char *argv[])
1696    /* キーの初期化 */    /* キーの初期化 */
1697  /* MAKAI start */  /* MAKAI start */
1698    if ( seed == 0 ) {    if ( seed == 0 ) {
1699     srand( time( NULL ) );     seed = (unsigned int)time( NULL );
   } else {  
    srand( seed );  
1700    }    }
1701      if ( verbose ) {
1702       printf( "乱数の種 = %u\n", seed );
1703      }
1704      srand( seed );
1705  /* MAKAI end */  /* MAKAI end */
1706    key_init(key);    key_init(key);
1707    set_salt(code, crypt64_descs[0], key);    set_salt(code, crypt64_descs[0], key);
# Line 1737  main(int argc, char *argv[]) Line 1785  main(int argc, char *argv[])
1785     return errno;     return errno;
1786    }    }
1787    setvbuf( tfp, NULL, _IONBF, BUFSIZ );    setvbuf( tfp, NULL, _IONBF, BUFSIZ );
1788      if ( (nfp = fopen("lognum.txt", "at")) == NULL ) {
1789       perror("lognum.txt");
1790       return errno;
1791      }
1792      setvbuf( nfp, NULL, _IONBF, BUFSIZ );
1793  /* MAKAI end */  /* MAKAI end */
1794    
1795    mincnt = 0x7FFFFFFF;    mincnt = 0x7FFFFFFF;

Legend:
Removed from v.203  
changed lines
  Added in v.204

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26