Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB help! making connect 4 game

    I have to make a 2 player game of connect 4 using visual basic!
    I have created the gui, and written the code to enter player names!
    I keep confusing myself on how to get it to work
    use a counter to count who's turn it is?? confused! can anyone help??
    WEB IDIOT sorry!

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    This is a homework assignment isn't it? I had to write a program in college to simulate the connect 4 game. It was in java though.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just part of a module! can you help?
    WEB IDIOT sorry!

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So how do you want us to help exactly? You could use a counter to keep track of whose turn it is using modulus. If there are 2 players, counter mod 2 will result in 0 if it's player 1 or 1 if it's player 2.

    Is that all?

    Check out planet-source-code, I wouldn't be surprised if this project is available for download. (Why re-invent the wheel? Unless this is a school project of course..)

    Hope that helps,
    Sadiq.

  • #5
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A Boolean is better for a token in a two player game:

    Code:
    Dim Turn1P as Boolean
    
    Sub SwitchTurns()
      Turn1P = Not Turn1P
      ' now add extra code to handle turn switching according to Turn1P
    End Sub
    shmoove


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •