‡CLAN‡さんとモバ友になろう!

日記・サークル・友達・楽しみいっぱい!

Yahoo! JAPAN IDだけで遊べる!今すぐ遊ぶ!

    • 2010/1/6 13:49
    • part2
    • コメント(0)
    • 閲覧(32)
  • "アバター"
    • int *move(int PLAYER)
      {

      int *pt, *pt1;

      pt = &board[0][0];
      do pt1 = pt + (int) (rand() / (RAND_MAX + 1.0) * (SIZE + 2) * (SIZE + 2));
      while (!(*pt1 == NO_PIECE &&

      (*(pt1 - SIZE - 3) == BLACK || *(pt1 - SIZE - 3) == WHITE ||
      *(pt1 - SIZE - 2) == BLACK || *(pt1 - SIZE - 2) == WHITE ||
      *(pt1 - SIZE - 1) == BLACK || *(pt1 - SIZE - 1) == WHITE ||
      *(pt1 - 1) == BLACK || *(pt1 - 1) == WHITE ||
      *(pt1 + 1) == BLACK || *(pt1 + 1) == WHITE ||
      *(pt1 + SIZE + 1) == BLACK || *(pt1 + SIZE + 1) == WHITE ||
      *(pt1 + SIZE + 2) == BLACK || *(pt1 + SIZE + 2) == WHITE ||
      *(pt1 + SIZE + 3) == BLACK || *(pt1 + SIZE + 3) == WHITE)));

      *pt1 = PLAYER;
      return pt1;
      }

      int check(int PLAYER, int *pt)
      {






      return 0;
      }

      void init(void)
      {
      int i, *pt, *pt1;

      pt = &board[0][0];
      pt1 = pt + (SIZE + 2)*(SIZE + 2);
      do *--pt1 = 0; while (pt1 > pt);
      for (pt1 = pt,i = 0;i < SIZE + 2; i++) *pt1++ = WALL;
      for (pt1 = pt,i = 0;i < SIZE; i++) *(pt1 += SIZE + 2) = WALL;
      for (pt1 = pt + (SIZE + 2)*(SIZE + 2) - 1,i = 0;i < SIZE + 2; i++) *pt1-- = WALL;
      for (pt1 = pt + (SIZE + 2)*(SIZE + 2) - 1,i = 0;i < SIZE; i++) *(pt1 -= SIZE + 2) = WALL;

      *(pt + ((SIZE + 2)*(SIZE + 2) - 1)/2) = 1;

      }

      void print_board(void)
      {
      int i,j;
      for (i = 0;i < SIZE + 2; i++)
      {
      for (j = 0;j < SIZE + 2; j++) {
      if (board[i][j] == 0) printf(" ");
      else if (board[i][j] == BLACK) printf("(*)");
      else if (board[i][j] == WHITE) printf("( )");
      else if (board[i][j] == WALL) {
      if (i == 0 && j == 0) printf(" ");
      else if (i == 0 && j > 0 && j <= SIZE) printf("%3d", j);
      else if (i > 0 && i <= SIZE && j == 0) printf("%3d", i);
      }
      }
      printf("\n");
      }
      }

コメント一覧

更新する

この日記を違反通報する

‡CLAN‡さんの
最新日記

‡CLAN‡さんの
お友達の最新日記

日記を探す

気になるキーワードで検索

みんなの新着日記