Euclid's game.

This is a discussion on Euclid's game. within the A Brief History of Cprogramming.com forums, part of the Community Boards category; is it true that if you make the 1st move on this game you always win?...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    494

    Euclid's game.

    is it true that if you make the 1st move on this game you always win?
    When no one helps you out. Call google();

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    No. Consider 8 and 2.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    im confused lol im playing the game and trying to figure out a pattern but theres always something that breaks the pattern. how come the game depends on the orignal two numbers and not who makes the first move?

    edit: you can play the game here http://www.cut-the-knot.org/blue/EuclidAlg.shtml
    When no one helps you out. Call google();

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    i think i figured out the pattern. tell me if this is true.

    Code:
     if in the original 2 numbers, the bigger number is odd, whoever makes the 1st move wins!.
    
    if in the original 2 numbers, the bigger number is even, whoever makes the 2nd move wins!
    When no one helps you out. Call google();

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    The way to figure out who goes first is by calculating n/gcd(n,m) where n and m are the two numbers, n>m. If n/gcd(n,m) is odd, the 1st player will win. If it is even, then the 2nd player will win.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 01:48 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-25-2002, 12:00 AM

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