any way to increase the difficulty?=)
Hey nice work! I like the nice sleek clean look to your screenshots.
Any interest in the current PGD Challenge?
A lot of game developers from all skill levels really enjoy taking part and it doesn't even have to be overly complex either. Though many do try.
Keep making games.
On Delphi About there is an interesting article about adding Artifical Intelligence to games. Article shows how to make "self learning AI" in Nepali game named "GATTA TIPNE KHEL" (meaning pebble picking game).
http://delphi.about.com/od/gameprogr...gamesample.htm
It would be posiible to implement similar approach into "Four in a row" game which would make game harder and harder the more you play, making it almost unbetable at the end.
Hello! I would like to present the new version of my FlashPascal Four-in-row. The interface has been remade. The engine is the one (with small adaptations) I used in my Lazarus project.
You can play the game on line. It should detect the local language (limited to english, german and french) and display the appropriate messages.
Last edited by Roland Chastain; 18-04-2014 at 03:51 PM.
Is it just my opinion or you also did some work on AI making it smarter?
Indeed, I remade the AI. I hope I made it better.
The evaluation procedure is more precise. I use an array of all good sequences. Each sequence found increase the result.
Code:const motifs: array[0..13, 0..1]of string = ( ('OOOO', 'XXXX'), ('OOO.', 'XXX.'), ('.OOO', '.XXX'), ('OO.O', 'XX.X'), ('O.OO', 'X.XX'), ('OO..', 'XX..'), ('O.O.', 'X.X.'), ('O..O', 'X..X'), ('.O.O', '.X.X'), ('..OO', '..XX'), ('O...', 'X...'), ('.O..', '.X..'), ('..O.', '..X.'), ('...O', '...X') ); const demiDroites: array[0..24, 0..3] of integer = ( (1, 1, +1, 0), (1, 2, +1, 0), (1, 3, +1, 0), (1, 4, +1, 0), (1, 5, +1, 0), (1, 6, +1, 0), (1, 1, 0, +1), (2, 1, 0, +1), (3, 1, 0, +1), (4, 1, 0, +1), (5, 1, 0, +1), (6, 1, 0, +1), (7, 1, 0, +1), (1, 1, +1, +1), (1, 2, +1, +1), (1, 3, +1, +1), (1, 4, +1, -1), (1, 5, +1, -1), (1, 6, +1, -1), (7, 1, -1, +1), (7, 2, -1, +1), (7, 3, -1, +1), (7, 4, -1, -1), (7, 5, -1, -1), (7, 6, -1, -1) ); function tClasseGrille.Points(const aPion: char): integer; var i, j, k, l: integer; x, y: integer; segment: string; begin result := 0; l := Ord(aPion = BLANC); for i := Low(demiDroites) to High(demiDroites) do begin x := demiDroites[i, 0]; y := demiDroites[i, 1]; segment := ' '; j := 1; repeat segment[j] := grille[x, y]; Inc(x, demiDroites[i, 2]); Inc(y, demiDroites[i, 3]); Inc(j); until (x < UN) or (x > SEPT) or (y < UN) or (y > SIX); for j := Low(motifs) to High(motifs) do if Pos(motifs[j, l], segment) > 0 then begin case j of 0: k := 75000; 1..4: k := 2500; 5..9: k := 50; else k := 1; end; Inc(result, k); end; end; end;
Last edited by Roland Chastain; 19-04-2014 at 07:14 AM.
It made it much harder. So far after about a dozen plays I haven't won even once. Lost two times and the rest times resulted in draw.
But now the AI moves seems ... artificial. When you are playing AI doesen't just prevent you from winning but on my opinion prevent you even from coming close to winning.
In all my lays I havent managed to reach a point where I would have tre in a row and AI would be forced to block the fourth one. AI simply folows certain path were it even prevents you to prepare any posible winning situation. And this is a joy killer.
Yes, it's a very good observation.
The a variable is an array of the maximal opponent's score at next move. And 2500 means three stones aligned.Code:if Max(a) >= 2500 then result := IndexOf(a, Min(a))
Yes, I see what you mean. I will keep it in mind. Anyway thank you for trying my program and for your instructive report.
Last edited by Roland Chastain; 19-04-2014 at 10:19 AM.
Bookmarks