Four-in-a-row

User projects written in or related to FreeBASIC.
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Four-in-a-row

Postby VANYA » May 31, 2012 4:22

Thanks to Roland Chastain and its simple and intuitive algorithm, I wrote this game. Platforms: Windows, Linux

Image


Download
codeFoil
Posts: 255
Joined: Dec 22, 2011 4:45
Location: United States
Contact:

Re: Four-in-a-row

Postby codeFoil » May 31, 2012 4:47

Nice! But that polar bear makes me nervous :)
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: Four-in-a-row

Postby Lachie Dazdarian » May 31, 2012 19:41

Sweet and smooth. How about a drop down menu with more backgrounds to choose from and an option to play against a human opponent?
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Four-in-a-row

Postby VANYA » Jun 01, 2012 2:52

codeFoil wrote:Nice! But that polar bear makes me nervous :)


thank you.

Lachie Dazdarian wrote:Sweet and smooth. How about a drop down menu with more backgrounds to choose from and an option to play against a human opponent?


I think it is achievable
Roland Chastain
Posts: 856
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Four-in-a-row

Postby Roland Chastain » Jun 01, 2012 4:25

Thank you, Vanya ! I am very glad to see my algorithm working in a nice program. Well done !
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Four-in-a-row

Postby VANYA » Jun 01, 2012 7:25

Roland Chastain wrote:Thank you, Vanya ! I am very glad to see my algorithm working in a nice program. Well done !


Thank you Roland! You do not have the desire to make the algorithm Backgammon? And I'd love to have made ​​an interface for it :)
Roland Chastain
Posts: 856
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Four-in-a-row

Postby Roland Chastain » Jun 01, 2012 11:37

VANYA wrote:You do not have the desire to make the algorithm Backgammon?


Why not ? But I first have to learn the rules. I have heard of this game but I don't know it. :-)
tabaouet
Posts: 1
Joined: Jun 05, 2012 19:16

Re: Four-in-a-row

Postby tabaouet » Jun 05, 2012 19:20

hola Roland , sympa ton jeu mais crispant pour moi ,, ahahahaha , suis pas douée pour ce genre de jeu
ai eu quelques nouvelles de toi et de ta famille par ta mère ,,, bisous de ta tante Monique
Roland Chastain
Posts: 856
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Four-in-a-row

Postby Roland Chastain » Jun 06, 2012 9:41

:-)
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: Four-in-a-row

Postby Lachie Dazdarian » Jul 09, 2012 20:59

Any updates on this game? Human opponent?
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Four-in-a-row

Postby VANYA » Jul 10, 2012 2:41

Lachie Dazdarian wrote:Any updates on this game?


While not.

Human opponent?


Human opponent I will not do, only the ability to change the appearance of and bugs
Roland Chastain
Posts: 856
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Four-in-a-row

Postby Roland Chastain » Jul 10, 2012 8:35

VANYA wrote:Human opponent I will not do, only the ability to change the appearance of and bugs


Hello !

Vanya, if you want, I can give you the hand to look for bugs. (There is one I noticed.) I can also ask to my friend who made sounds for Frogger if he has time to make two or three sounds for your game. What do you think about this ?

Roland
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Four-in-a-row

Postby VANYA » Jul 10, 2012 9:41

Roland Chastain wrote:
VANYA wrote:Human opponent I will not do, only the ability to change the appearance of and bugs


Hello !

Vanya, if you want, I can give you the hand to look for bugs. (There is one I noticed.) I can also ask to my friend who made sounds for Frogger if he has time to make two or three sounds for your game. What do you think about this ?

Roland


If you are not hard, it would be nice.

I do not know, how best to make the options . One time I tried, but it turned out badly, and is now busy with other things. How I to choose the time for the game and there will be a desire, to again try to implement.
Roland Chastain
Posts: 856
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Four-in-a-row

Postby Roland Chastain » Jul 12, 2012 9:28

Hello Vanya !

The bug I noticed is in the end of the game. When the grid is full, the computer says to me that I lost.

So I had a look at your code, and I didn't see anything for this case.

Code: Select all

      If Finish = 1 Then
         Draw_String (55,450,"Congratulations, you win! Press any key...",1.6)
      ElseIf Finish = 2 Then         
         Draw_String (157,450,"You lost! Press any key...",1.6)
      EndIf


It seems you forgot the case of draw (when nobody wins).

I see that :

Code: Select all

            finish = 0
            Initialise


But why isn't there a message for this ?

Another observation, about the variable named "automate", which means AI. In my mind, this variable could have two values : "Rouge" (red, -1) or "Jaune" (yellow, 1). It means what color the AI plays. So I don't understand why you change the value of this variable in the middle of a game :

Code: Select all

Sub four.AlgMove()
   If md->MY < 30 Then Exit Sub
   flagnew = Ajoute (Courante, Trait, oldplace)
   If flagnew=-1 Then
      Xnew = oldplace
      Automate = 0 <---
      Check()
      If  Trait = Neant Then
         Beep
         Finish = 1
         Exit sub
      EndIf
      Xnew = MeilleurCoup
      Ajoute (Courante, Trait, Xnew)
      Automate = 2 <---
      Check()


And I don't see what means the value 0. This value could be used for a human-human game, but here I don't see what you had in mind.
VANYA
Posts: 1331
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Four-in-a-row

Postby VANYA » Jul 12, 2012 11:13

It seems you forgot the case of draw (when nobody wins).


Yes, I know about this error and will correct it'll take both back in the game

Another observation, about the variable named "automate", which means AI. In my mind, this variable could have two values : "Rouge" (red, -1) or "Jaune" (yellow, 1). It means what color the AI plays. So I don't understand why you change the value of this variable in the middle of a game :


I've changed your source code. You will notice that the file alg.bas something changed. I have a variable charge Automate simple animation of balls (or rather the color when the ball drops). Of course, need to change the name of the variable, although for me the source code looks obvious.

Return to “Projects”

Who is online

Users browsing this forum: Google [Bot] and 2 guests