• 大小: 687KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-23
  • 语言: 其他
  • 标签: 亚马逊  

资源简介

如果你做机器博弈,这可以供你参考,不容易下的哦。希望对你有帮助。

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 

#include “amazons.h“
#include “board.h“
#include “position.h“
#include “makros.h“
#include “callbacks.h“

/* local Prototypes */


static void fill_a_square(GnomeCanvasGroup *group
        double x1 double y1 double x2 double y2 char *color);
static void get_square_color(int square char *color);

/* Globals */
int what_next; //
extern Board *board;
extern struct options options;
extern struct game_states states;
extern int ok;
extern time_t start;
Square legal_moves[100];

void init_game_board(GtkWidget *GamazonsMain)
{
   int ij;
   char color[256];
   GtkWidget *w = lookup_widget(GamazonsMain BOARD_NAME);
   

   board = (Board *) malloc(sizeof(Board));
   board->canvas = GNOME_CANVAS(w);

   /* set where can the canvas scroll (our usable area) */
   gnome_canvas_set_scroll_region(board->canvas 0.0 0.0
   BOARD_SIZE*CELL_SIZE + 2*BOARD_BORDER
   BOARD_SIZE*CELL_SIZE + BOARD_BORDER);

   /* set the size of the widget */
   gtk_widget_set_usize(w
   BOARD_SIZE*CELL_SIZE + 2*BOARD_BORDER
   BOARD_SIZE*CELL_SIZE + BOARD_BORDER);


   /* initialize pieces */
   for (i=0; i     {
      for (j=0; j {
 board->squares[i][j] = NOTHING;
}
     }
   gtk_signal_connect(GTK_object(board->canvas) “event“
   GTK_SIGNAL_FUNC(arrow_fire_cb) NULL);
/*
   board_signals[MOVE_SIGNAL]
       = gtk_signal_new (“move“
       GTK_RUN_FIRST
       object_class->type
       GTK_SIGNAL_OFFSET (BoardClass move)
       gtk_marshal_NONE__INT_INT
       GTK_TYPE_NONE 2
       GTK_TYPE_INT GTK_TYPE_INT);

   board_signals[FLIP_SIGNAL]
       = gtk_signal_new (“flip“
       GTK_RUN_FIRST
       object_class->type
       GTK_SIGNAL_OFFSET (BoardClass flip)
       gtk_marshal_NONE__BOOL
       GTK_TYPE_NONE 1
       GTK_TYPE_BOOL);

   gtk_object_class_add_signals (object_class
   board_signals
   LAST_SIGNAL);
*/



   /*
   board->squares[3][9] = WHITE;
   board->squares[6][9] = WHITE;
   board->squares[0][6] = WHITE;
   board->squares[9][6] = WHITE;

   board->squares[3][0] = BLACK;
   board->squares[6][0] = BLACK;
   board->squares[0][3] = BLACK;
   board->squares[9][3] = BLACK;
   */
   board->squares[9][3] = WHITE;
   board->squares[9][6] = WHITE;
   board->squares[6][0] = WHITE;
   board->squares[6][9] = WHITE;

   board->squares[0][3] = BLACK;
   board->squares[0][6] = BLACK;
   board->squares[3][0] = BLACK;
   board->squares[3][9] = BLACK;

   draw_board();
   what_next = MOVE_WHITE_QUEEN;


}

static void
draw_a_line(GnomeCanvasGroup *group
        int x1 int y1 int x2 int y2 char *color)
{
   GnomeCanvasPoints *points;

   /* allocate a new points array */
   points = gnome_canvas_points_new (2);

   /* fill out the points */
   points->coords[0] = x1;
   points->coords[1] = y1;
   points->coords[2] = x2;
   points->coords[3] = y2;
   /* draw the line */
   gnome_canvas_item_new(group
   gnome_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        142  2002-08-10 09:23  gamazons-0.70\acconfig.h

     文件      25945  2002-08-10 09:23  gamazons-0.70\aclocal.m4

     文件          0  2002-08-10 09:23  gamazons-0.70\AUTHORS

     文件        439  2002-08-10 09:23  gamazons-0.70\autogen.sh

     文件          0  2002-08-10 09:23  gamazons-0.70\ChangeLog

     文件       3482  2002-08-10 09:23  gamazons-0.70\config.cache

     文件       3809  2002-08-10 09:23  gamazons-0.70\config.h

     文件       3560  2002-08-10 09:23  gamazons-0.70\config.h.in

     文件       3015  2002-08-10 09:23  gamazons-0.70\config.log

     文件      16799  2002-08-10 09:23  gamazons-0.70\config.status

     文件      97150  2002-08-10 09:23  gamazons-0.70\configure

     文件        626  2002-08-10 09:23  gamazons-0.70\configure.in

     文件          0  2002-08-10 09:23  gamazons-0.70\COPYING

     文件      14821  2002-08-10 09:23  gamazons-0.70\gamazons.glade

     文件      14821  2002-08-10 09:23  gamazons-0.70\gamazons.glade.bak

     文件        238  2002-08-10 09:23  gamazons-0.70\gamazons.gladep

     文件        238  2002-08-10 09:23  gamazons-0.70\gamazons.gladep.bak

     文件          0  2002-08-10 09:23  gamazons-0.70\INSTALL

     文件          0  2002-08-10 09:23  gamazons-0.70\install-sh

     文件      13424  2002-08-10 09:23  gamazons-0.70\Makefile

     文件        664  2002-08-10 09:23  gamazons-0.70\Makefile.am

     文件      12244  2002-08-10 09:23  gamazons-0.70\Makefile.in

     文件          0  2002-08-10 09:23  gamazons-0.70\missing

     文件          0  2002-08-10 09:23  gamazons-0.70\mkinstalldirs

     文件          0  2002-08-10 09:23  gamazons-0.70\NEWS

     文件          0  2002-08-10 09:23  gamazons-0.70\po\ChangeLog

     文件       7167  2002-08-10 09:23  gamazons-0.70\po\Makefile

     文件       7088  2002-08-10 09:23  gamazons-0.70\po\Makefile.in

     文件       7126  2002-08-10 09:23  gamazons-0.70\po\Makefile.in.in

     文件         79  2002-08-10 09:23  gamazons-0.70\po\POTFILES

............此处省略187个文件信息

评论

共有 条评论