資源簡介
最近在學C和gtk+,做了個五子棋,和三子棋算法一樣。多注釋,簡單易懂。算法重要,界面在其次。
代碼片段和文件信息
/*
?============================================================================
?Name????????:?Five.c
?Author??????:?delmore
?Version?????:
?Copyright???:?Your?copyright?notice
?Description?:?Hello?World?in?C?Ansi-style
?============================================================================
?*/
#include?
#include?
#include?
static?int?SIZE?=?20;
static?GtkWidget*?g_btn[20][20];
static?int?round?=?0;
static?GtkWidget?*window;
static?GtkWidget?*dialog;??????//聲明一個對話框
static?int?gameOver?=?0; //標志游戲是否結束
static?void?btnClick(GtkWidget*?widgetgpointer?data){
if(NULL?==?gtk_button_get_label(GTK_BUTTON(widget))?&&?gameOver?==?0){
if(0?==?round){
gtk_button_set_label(GTK_BUTTON(widget)“0“);
}else{
gtk_button_set_label(GTK_BUTTON(widget)“X“);
- 上一篇:收割機去后門版本.rar
- 下一篇:數據結構實用教程(第二版)
評論
共有 條評論