• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUInteger hash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUInteger hash


  • Subject: Re: NSUInteger hash
  • From: "Kyle Sluder" <email@hidden>
  • Date: Sun, 17 Aug 2008 15:08:36 -0400

On Sun, Aug 17, 2008 at 12:43 PM, Steve Wart <email@hidden> wrote:
> I go through the rooms in random order, pick a wall at random, and knock it
> down (also being careful to knock down the corresponding wall in any
> adjacent rooms). By knocking down a wall, two rooms become merged into one.
> When I have only one room left, it means that the maze is complete.

Sounds like the perfect use case for union-find.  Since each cell can
only have four walls, you really only need three bits per cell.  You
could use a 2D array of bytes to represent your entire maze, and
randomly toggle bits until you wind up with one set (room).  Then,
once the maze has been generated, convert that into an object
representation for the rest of your app to consume.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSUInteger hash (From: "Steve Wart" <email@hidden>)
 >Re: NSUInteger hash (From: "Steve Wart" <email@hidden>)

  • Prev by Date: Re: building a command-line tool as a bundle
  • Next by Date: Re: creating files to write data to?
  • Previous by thread: Re: NSUInteger hash
  • Next by thread: Re: NSUInteger hash
  • Index(es):
    • Date
    • Thread