home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
207.lha
/
BackGammon
/
backmenu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-12-27
|
6KB
|
205 lines
/********************************************************************/
/* */
/* Hoser BackGammon version 1.0 */
/* */
/* Robert Pfister */
/* */
/* Rfd#3 Box 2340 home:(207)-873-3520 */
/* Waterville, Maine 04901 */
/* */
/* Pfister_rob%dneast@dec.decwrl */
/* */
/* */
/* Copyright June,1987 all rights reserved. */
/* */
/* This program will play a game of backgammon at the novice level */
/* */
/* The code is in 4 parts... */
/* */
/* 1) back.c - main driver */
/* 2) eval.c - evaluation of moves */
/* / 3) backscn.c - screen stuff.. */
/* \/ 4) backmenu.c - menu stuff, help text, and ``decoder'' */
/* */
/* this was compiled under Manx 3.20a, using long integers */
/* */
/********************************************************************/
#include "functions.h"
#include "exec/types.h"
#include "intuition/intuition.h"
char *Help[] =
{
"Help\0",
"To move a peice, click on it with the left mouse button, \n",
"then click on the spike that you want to move the peice. \n",
" \n",
"The `bar' is the center strip of the board. \n",
" \n",
"If your move is invalid, an error message will be displayed\n",
"in the menu strip. \n",
" \n",
"To `cast off' peices, double click on the peice desired \n",
" \n",
"If you cannot move, click on your dice. \n",
" \n",
"The number that appears below the menu bar is the number \n",
"of the position that's being evaluated. For doubles \n",
"this number can reach around 5000, so be patient \n",
" \n",
"`Redo Move' returns board to the start of the move \n",
"`Take Back' will back up one move \n",
};
int NumHelp=18;
char *credits[] =
{
"Credits \0",
"Hoser BackGammon Copyright June 1987 Robert Pfister \n",
" \n",
"Written in Aztec 'C' 3.20 as an A.I. course project. Use's \n",
"home-brewed heuristics to play like I would. \n",
" \n",
"Snail-Mail: {donations accepted..I suppose} \n",
" Robert Pfister \n",
" Rfd#3 box 2340 \n",
" Waterville, Maine 04901 phone: 207-873-3520 \n",
" \n",
"or E-Mail: pfister_rob%dneast.dec@decwrl.dec.com \n",
" \n",
"Freely Distributable if I'm credited with the Original version\n"
};
int NumCredits=13;
struct IntuiText IText[]=
{
{0,1,JAM1,CHECKWIDTH,0,NULL,"New Game"}, /* 0 */
{0,1,JAM1,CHECKWIDTH,0,NULL,"Info"}, /* 1 */
{0,1,JAM1,CHECKWIDTH,0,NULL,"Quit"}, /* 2 */
{0,1,JAM1,CHECKWIDTH,0,NULL,"Help"}, /* 3 */
{0,1,JAM1,CHECKWIDTH,0,NULL,"Back up"}, /* 4 */
{0,1,JAM1,CHECKWIDTH,0,NULL,"Redo Move"} /* 5 */
};
struct MenuItem MenuI[]=
{
/* newgame 0: */
{ &MenuI[1],
0,0,83,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[0],
NULL,NULL,NULL
},
/* info 1: */
{ &MenuI[2],
0,9,83,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[1],
NULL,NULL,NULL
},
/* quit 2: */
{ NULL,
0,18,83,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[2],
NULL,NULL,NULL
},
/* help 3: */
{ &MenuI[4],
0,0,99,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[3],
NULL,NULL,NULL
},
/* Takeback 4: */
{ &MenuI[5],
0,9,99,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[4],
NULL,NULL,NULL
},
/* move hint 5: */
{ NULL,
0,18,99,9,
(ITEMTEXT|ITEMENABLED|HIGHCOMP),
NULL,
(APTR) &IText[5],
NULL,NULL,NULL
}
};
struct Menu Menu[]=
{
{ &Menu[1],
0,0,83,0,
MENUENABLED,
"Project",
&MenuI[0] },
{ NULL,
80,0,80,0,
MENUENABLED,
"Cheating",
&MenuI[3] }
};
struct Menu *MyMenu=&Menu[0];
DoMenu(x)
int x;
{
int i,temp;
switch (x)
{
case 31:Restart(); return(1); break; /* new game */
case 51:return(-1); /* quit */
break;
/* put up a window with the credits in it */
case 41:TextScreen(credits,NumCredits);
break;
/* take back a full move */
case 141:RecallMove(-1);
break;
case 151:RecallMove(0);
break;
/* do it for help as well */
case 131:TextScreen(Help,NumHelp);
break;
default:break;
}
return(0);
}