Like Tree1Likes
  • 1 Post By Salem

alternating players

This is a discussion on alternating players within the C Programming forums, part of the General Programming Boards category; So I'm working on several 2v2 programs like tic-tac-toe, connect four and battleship. Generally what would be the best way ...

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    9

    Question alternating players

    So I'm working on several 2v2 programs like tic-tac-toe, connect four and battleship. Generally what would be the best way to alternate players?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    An if statement usually works.
    vart likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum, ktype!

    Most chess programs use the simple: player=!player, where player is a bool or int value acting like a bool, with value of true/false, or 1/0.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alternating turns in C code for 2 player game
    By richardpd in forum C Programming
    Replies: 7
    Last Post: 01-20-2013, 04:41 PM
  2. Replies: 2
    Last Post: 08-23-2009, 08:52 AM
  3. alternating sum
    By alyeska in forum C++ Programming
    Replies: 20
    Last Post: 01-04-2008, 08:45 PM
  4. MP3 Players
    By Dark_Phoenix in forum Tech Board
    Replies: 5
    Last Post: 12-03-2006, 02:22 PM
  5. dvd players
    By metsman20 in forum Tech Board
    Replies: 1
    Last Post: 12-26-2003, 08:56 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21