Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23709
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2013-04-28 19:01 -0700 |
| References | <77f5a380-09d9-4054-b26f-22b32424b504@googlegroups.com> <see-26AA3F.21063828042013@news.eternal-september.org> <_O2dnTt1ffU3YeHMnZ2dnUVZ8oSdnZ2d@bt.com> <fe64495d-9551-45f5-b0c5-b4149ad8276d@googlegroups.com> <klk0jt$qii$1@dont-email.me> |
| Message-ID | <35625709-8ffa-4b63-8458-012c5b82e2f4@googlegroups.com> (permalink) |
| Subject | Re: depth first search |
| From | Lew <lewbloch@gmail.com> |
Alex wrote: > Meanwhile, it sounds like you'll need to keep track of the adjacent > unoccupied locations you come across as you traverse the group, but I > don't play Go, so I don't know how this information is used to > determine if a group is "alive" or "dead". Markspace suggests that as > long as there is any open adjacent location the group is alive, but > Wikipedia suggests that there needs to be at least two internal "eyes" > to make a group "alive", so I dunno. You point to the fundamental way to model the game. You mention terms of art in the domain being modeled, in this case the game of Go, and work to define them precisely within the model, i.e., to describe their attributes and/or behaviors. In terms of each other. If you start out modeling "liveness" as characters, several things go wrong. As your domain knowledge grows (does "alive" mean "has two or more Eyes in the Group"?) you add more arbitrary character-to-meaning associations. Now '1' means "has liberty" and '2' means "is alive" and '3' means "is dead", and '4' means "not yet determined" - no wait, couldn't a "group" both "have a liberty" and be "not yet determined", or "alive", or "dead"? Drat, now I need '5' to mean "has liberty" and "not yet dead", no wait, "not yet determined", or did I mean "dead"? So you write types that semantically match the language that you're modeling. You might give a 'Group' type an attribute 'hasLiberty' (modeled with methods 'hasLiberty()' and 'setLiberty()'). You could give it a separate 'alive' attribute of type 'Boolean', where 'TRUE' means "alive", 'FALSE' means "dead", and 'null' means "not yet determined". then you can code logic that makes sense, such as if (group.isAlive() && adjacentIntersection.isEmpty()) ... You won't get lost trying to remember what '2' means. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
depth first search willmann817@gmail.com - 2013-04-27 21:46 -0700
Re: depth first search Barb Knox <see@sig.below> - 2013-04-28 21:06 +1200
Re: depth first search "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-04-28 11:40 +0100
Re: depth first search willmann817@gmail.com - 2013-04-28 07:22 -0700
Re: depth first search "Alex" <foo@email.invalid> - 2013-04-28 20:25 +0000
Re: depth first search Lew <lewbloch@gmail.com> - 2013-04-28 19:01 -0700
Re: depth first search Lew <lewbloch@gmail.com> - 2013-04-28 18:42 -0700
Re: depth first search Barb Knox <see@sig.below> - 2013-04-29 13:59 +1200
Re: depth first search lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-04-29 11:21 +0100
Re: depth first search Barb Knox <see@sig.below> - 2013-05-02 16:02 +1200
Re: depth first search markspace <markspace@nospam.nospam> - 2013-04-28 12:22 -0700
Re: depth first search markspace <markspace@nospam.nospam> - 2013-04-28 12:49 -0700
Re: depth first search markspace <markspace@nospam.nospam> - 2013-04-28 16:21 -0700
Re: depth first search Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2013-04-28 21:43 -0500
Re: depth first search willmann817@gmail.com - 2013-04-29 08:46 -0700
csiph-web