Thread: game of life

  1. #1
    Registered User
    Join Date
    Dec 2016
    Posts
    5

    game of life

    i need to write code for external game of life (player vs computer).
    anyone have full code for normal game of life or sth like that?
    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    1. the game of life is normally a computer simulation. What does it mean to have player vs. computer.

    2. I'm sure google can find many source code examples you can cheat from.

    3. Try doing some work for yourself. If you're aspiring to a career as a software developer, you need to pull your finger out.
    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.

  3. #3
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    This is a strange question.
    What is an "external" game of life?
    How can a player play against the computer?
    What does it mean???

  4. #4
    Registered User
    Join Date
    Dec 2016
    Posts
    5
    I had started to write the code, but i need an idea for generations. Thanks for help.
    We got a exersice to build the game with new conditions.

  5. #5
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Since you seem unable or unwilling to explain those "new conditions", why not give us a link to your assignment?
    I'm curious.

  6. #6
    Registered User
    Join Date
    Dec 2016
    Posts
    5
    the rule of my excersice is not by english.
    but i can arite in short (my english is bad):
    a. the user choose the number of living cells, and he choose the color- red(for player), green (for computer).
    b. first generation. normal rules, but if dead cell have a 3 neighbers, he will wake up with the most common color of his neighber (2 red,1 green- red, 2 green 1 red- green etc).
    c genertion go ahead.
    d. user choose dead cell to get alive. one turn for him, one for computer.
    etc

  7. #7
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Your English is actually pretty good!
    I am beginning to understand your program.
    I have some questions.

    a. the user choose the number of living cells, and he choose the color- red(for player), green (for computer).
    The user chooses the number of living cells.
    Does he also choose the cell positions or are they chosen randomly?


    b. first generation. normal rules, but if dead cell have a 3 neighbors, he will wake up with the most common color of his neighbor (2 red,1 green- red, 2 green 1 red- green etc).
    c. generation go ahead.
    Parts b and c happen automatically, right?


    d. user choose dead cell to get alive. one turn for him, one for computer.
    At this point the user chooses a dead cell to turn into a living cell, and the computer does the same (presumably randomly).


    How are you going to display the board? You talk about red and green, so apparently it's not a console program.

    Also, where exactly are you stuck?

  8. #8
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    > so apparently it's not a console program.

    It could be, as it might have the variables to represent each color which is then coordinated to that particular cell.

    Code:
    char red = 'R', green = 'G';
    Of course this is pure speculation. Doing this sort of thing GUI based however would ideally be presented in a better format than console.
    Double Helix STL

  9. #9
    Registered User
    Join Date
    Dec 2016
    Posts
    5
    The user also choose the position. About b-d, yes, and green is g and red is r.
    Also, the player choose the nunber of generations. After all generations, the winner is who has more living cells than other. (or if all living cells died in middle of game, the game is over and no one win)

  10. #10
    Registered User
    Join Date
    Dec 2016
    Posts
    5
    Later ill got my pc, than i show you example output

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. the game of life
    By ben432 in forum C Programming
    Replies: 1
    Last Post: 06-13-2011, 10:23 AM
  2. Game of Life... Turned my life to HELL!
    By yigster in forum C Programming
    Replies: 1
    Last Post: 05-21-2009, 06:29 PM
  3. Game of Life
    By CornedBee in forum Contests Board
    Replies: 74
    Last Post: 05-20-2008, 01:50 AM
  4. Game Of Life
    By din1983 in forum C Programming
    Replies: 20
    Last Post: 10-11-2005, 10:36 PM
  5. Game of Life - HELP!
    By Folklord* in forum C Programming
    Replies: 1
    Last Post: 01-14-2004, 04:21 AM

Tags for this Thread