Mail Archives: djgpp/1997/10/29/08:37:24
From: | Knut_Pape AT t-online DOT de (Knut Pape)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Newbie asking for Help !!!!
|
Date: | 25 Oct 1997 22:07:15 GMT
|
Organization: | T-Online
|
Lines: | 113
|
Message-ID: | <62tqij$mt9$1@news00.btx.dtag.de>
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I have just started programming with djgpp in C.
After reading some Tutorials and Book's I'm trying myself on my first
programm (4Gewinnt).
Now I have a big problem. I have a board of 42 fields, variables from f1
to f42.
f7 f14 f21 f28 f35 f42
f6 f13 f20 f27 f34 f41
f5 f12 f19 f26 f33 f40
f4 f11 f18 f25 f32 f39
f3 f10 f17 f24 f31 f38
f2 f9 f16 f23 f30 f37
f1 f8 f15 f22 f29 f36
Now the KI has to look up for deadly combinations
(the aim of the Game is to get for coins of your own color in a line.
Exampels: - | / \)
and has to check all usable fields.
With numbers as variables it wouldn't be very easy.
For checking the line 8, 15, 22, 29 I would write a part like:
if (1 == 1+7 & 1+7 == 1+14 & 1+22 == emty)
{
put Coin to 1+22 ;
end turn = Yes ;
}
Now I only have to change 1 for checking another line.
Qestion:
1.) Is there any possibility of changing a variable by adding numbers
or something else like this ?
[f"11+1" = f12 ?]
[int Lcoin = 11;
if (f"Lcoin" == ...) ?]
Please help me with a good idea.
I see a huge mountain of work befor me and
I think the way I have to go at the moment (writing Functions for
checking a combination
and calling it over an over again for every field) could not be the
best.
PS: Forgive me my worse "English" I'm from Germany and I'm not verry
good in English.
( Reading - Okay, but writing is another world.) ;-)
PPS: I want to say thankyou to Shawn Hargreaves for Allegro, it helped
me verry much.
please remove this : v
Answer to: Knut_Pape"nospamtome"@t-Online.de
- Raw text -