Conway's Game Of Life


Closed Thread
Results 1 to 40 of 46

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Conway's Game Of Life

    i had a bit of a "google" for stagnant life pattern detection . the answer was obvious CRC
    i resurrected my old code , added crc16 stored the last 8 crc's in a ring buffer. i then go on to check every new generation's
    crc for existence in the buffer, more than two counts and i call it a repeat and begin a new pattern
    works like a charm.
    Warning I'm not a teacher

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Conway's Game Of Life

    The array transform routine, as posted above executes in 4.66ms on my test hardware (18F46K42 @64MHz).
    It's a small improvement but I managed to reduce that to 4.28ms by changing it into two FOR/NEXT loops, one for odd, one for even rows.
    Code:
        FOR Col = 0 To 30 Step 2
            InPtr = (TempW + Col)
            led[InPtr] = lednew[InPtr]
            OutPtr = InPtr
           
            IF led[InPtr] > 0 THEN
               NeoLed(OutPtr) = Led[InPtr]	
               alive = alive + 1
               dead = dead + InPtr
            ELSE
                NeoLED(OutPtr) = 0
            ENDIF
        NEXT
        
        FOR Col = 1 To 31 Step 2    ' Odd rows
            InPtr = (TempW + Col)
            led[InPtr] = lednew[InPtr]
            OutPtr = (TempW) + (31-Col)   'Reversed order
            
            IF led[InPtr] > 0 THEN
               NeoLed(OutPtr) = Led[InPtr]	
               alive = alive + 1
               dead = dead + InPtr
            ELSE
               NeoLED(OutPtr) = 0
            ENDIF
        NEXT
    I must point out though that I don't have the arrays populated with anything so their values are always zero which obviously will have an effect.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Conway's Game Of Life

    Could I have a look at your Life CRC16 code please Richard?

Similar Threads

  1. programming jumping game
    By bokken in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th February 2012, 06:40
  2. Simon Game
    By flotulopex in forum Code Examples
    Replies: 1
    Last Post: - 4th November 2010, 06:25
  3. EEPROM life expectancy?
    By muddy0409 in forum General
    Replies: 3
    Last Post: - 1st May 2007, 12:44
  4. home brew game console W interface
    By PICMAN in forum General
    Replies: 1
    Last Post: - 15th March 2005, 22:25
  5. Game port to USB adaptor
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 24th September 2004, 03:16

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

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