From bc5ac3d46558512971ba8c0f6be02382d91d17f1 Mon Sep 17 00:00:00 2001 From: rodri Date: Fri, 6 Oct 2023 16:31:57 +0000 Subject: initial implementation of an AI. added different modes for those who want to play with others and those who prefer to play against a bot (-a flag). --- dat.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'dat.h') diff --git a/dat.h b/dat.h index 46a3c12..07b7dd3 100644 --- a/dat.h +++ b/dat.h @@ -18,6 +18,9 @@ enum { OH, /* horizontal */ OV, /* vertical */ + GMPvP = 0, + GMPvAI, + Waiting0 = 0, Watching, Ready, @@ -25,6 +28,10 @@ enum { Waiting, Playing, + ASearching = 0, + ACalibrating, + ABombing, + Boardmargin = 50, TW = 16, TH = TW, @@ -55,6 +62,7 @@ typedef struct Map Map; typedef struct Board Board; typedef struct Chanpipe Chanpipe; typedef struct Player Player; +typedef struct Andy Andy; typedef struct Match Match; typedef struct Msg Msg; typedef struct Stands Stands; @@ -94,12 +102,32 @@ struct Player Map; char name[8+1]; int state; + int gamemode; Match *battle; NetConnInfo *nci; Chanpipe io; Channel *ctl; }; +struct Andy +{ + Map; /* of the enemy */ + Player *ego; + int state; + Point2 lastshot; + Point2 firsthit; + Point2 passdir; /* direction of current pass */ + int ntries; /* attempts left to find the direction */ + int passes; /* remaining passes (one per direction) */ + + void (*layout)(Andy*, Msg*); + void (*shoot)(Andy*, Msg*); + void (*engage)(Andy*); + void (*disengage)(Andy*); + void (*registerhit)(Andy*); + void (*registermiss)(Andy*); +}; + struct Match { RWLock; -- cgit v1.2.3