Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20377 > unrolled thread
| Started by | infinitum3d@hotmail.com |
|---|---|
| First post | 2012-12-16 07:38 -0800 |
| Last post | 2012-12-18 10:35 -0800 |
| Articles | 20 on this page of 100 — 15 participants |
Back to article view | Back to comp.lang.java.programmer
proper use of .java files (layout) infinitum3d@hotmail.com - 2012-12-16 07:38 -0800
Re: proper use of .java files (layout) Robert Klemme <shortcutter@googlemail.com> - 2012-12-16 16:43 +0100
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-16 10:50 -0500
Re: proper use of .java files (layout) "John B. Matthews" <nospam@nospam.invalid> - 2012-12-16 16:25 -0500
Re: proper use of .java files (layout) markspace <-@.> - 2012-12-16 08:24 -0800
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-17 10:28 -0800
Re: proper use of .java files (layout) markspace <-@.> - 2012-12-17 13:17 -0800
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-17 13:51 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 20:55 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-17 18:18 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:28 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-17 21:10 -0800
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 08:53 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 09:13 -0800
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-18 09:23 -0800
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 13:49 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 15:05 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:11 -0500
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 21:07 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 09:33 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-19 10:12 -0800
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-19 13:35 -0800
Re: proper use of .java files (layout) Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-19 15:55 -0600
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-19 14:01 -0800
Re: proper use of .java files (layout) Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-19 16:05 -0600
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-19 04:06 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 12:24 +0000
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-19 13:36 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:10 -0500
Re: proper use of .java files (layout) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-18 12:14 -0600
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:04 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-19 10:14 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 19:18 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-20 11:05 +0000
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 21:43 -0500
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-27 18:49 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 22:10 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-20 09:01 -0800
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-20 09:30 -0800
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-20 13:35 -0800
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-20 14:00 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 08:58 +0000
Re: proper use of .java files (layout) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-12-21 10:36 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 18:43 +0000
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 22:05 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-28 09:57 +0000
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 21:59 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 21:53 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 21:54 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 21:48 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-27 21:11 -0800
Re: proper use of .java files (layout) "John B. Matthews" <nospam@nospam.invalid> - 2012-12-28 06:50 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-28 13:46 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-28 09:10 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 09:50 +0000
Re: proper use of .java files (layout) "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-12-18 13:09 +0000
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 14:05 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-25 15:06 -0800
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-26 06:31 -0800
Re: proper use of .java files (layout) Lew <lewbloch@gmail.com> - 2012-12-26 13:21 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-26 23:38 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-27 08:37 +0000
Re: proper use of .java files (layout) Robert Klemme <shortcutter@googlemail.com> - 2012-12-27 11:51 +0100
Re: proper use of .java files (layout) Patricia Shanahan <pats@acm.org> - 2012-12-27 08:46 -0800
Re: proper use of .java files (layout) Robert Klemme <shortcutter@googlemail.com> - 2012-12-27 18:20 +0100
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-27 20:48 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 20:58 -0500
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-17 18:22 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:39 -0500
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-17 21:25 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:29 -0500
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-17 21:32 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:37 -0500
Re: proper use of .java files (layout) Wayne <nospam@all.invalid> - 2012-12-18 18:45 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:13 -0500
Re: proper use of .java files (layout) infinitum3d@hotmail.com - 2012-12-16 09:23 -0800
Re: proper use of .java files (layout) infinitum3d@hotmail.com - 2012-12-16 21:07 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-17 10:32 +0000
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-17 21:03 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 09:34 +0000
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:00 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:01 -0500
Re: proper use of .java files (layout) infinitum3d@hotmail.com - 2012-12-18 06:32 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 15:05 +0000
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 11:07 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 16:27 +0000
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 11:44 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 17:21 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 09:21 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 17:39 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 10:40 -0800
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 19:05 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 15:15 -0800
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 14:12 -0500
Re: proper use of .java files (layout) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 19:39 +0000
Re: proper use of .java files (layout) Gene Wirchenko <genew@telus.net> - 2012-12-18 15:17 -0800
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 20:07 -0500
Re: proper use of .java files (layout) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 21:11 -0500
Re: proper use of .java files (layout) Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 22:24 -0500
Re: proper use of .java files (layout) markspace <-@.> - 2012-12-18 10:35 -0800
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2012-12-19 10:12 -0800 |
| Message-ID | <vf04d85sv0467c0uu6e2sc60ht312bs64b@4ax.com> |
| In reply to | #20513 |
On Wed, 19 Dec 2012 09:33:59 +0000, lipska the kat
<lipskathekat@yahoo.co.uk> wrote:
>On 19/12/12 02:07, Eric Sosman wrote:
>> On 12/18/2012 8:11 PM, Arne Vajhøj wrote:
>
>[snip]
>
>>> If the logic can be described precisely, then it can be
>>> implemented in code.
>>
>> Yes. But my principal point in all of this is that it cannot
>> always be implemented in *simple* code. Given the variety of card
>> games, it is folly to try to capture the notion of "card" in a
>> single, game-independent way.
>
>OK, I guess we got off on the wrong foot so I'll try again.
>I'm not trying to be condescending. I'm genuinely interested in your
>response.
>
>Can we agree that the names we give things help our understanding of
>what those things are supposed to represent ?
Sure. Remember, though, that the name is not the thing.
>In our world, it almost always the case that, sooner or later, someone
>who was not present during the design phase of our system will need to
>understand it in order to maintain it. Good names for system concepts help.
Sure. I go to the trouble of documenting them in a client
billing system that I maintain. I am likely the only one to look at
that part of the code, but I do it anyway because solid definitions
are important.
>If we think of a Card in the 'games played with cards' universe then,
>unless I've missed something a card is a small piece of cloth or
>cardboard that has some numbers, pictures or symbols on one or both
>sides. Maybe a better name would be PlayingCard
>
>The concept of a PlayingCard is fixed in our collective memory by virtue
>of the experiences we have of PlayingCards in our lives.
>Of course different cultures use cards in different ways to play
>different games but the point is, if you ask anyone on the planet what a
>PlayingCard is them I suggest that the basic concept will always be there.
But there are so many examples of definitions. I prefer to
solidify the definition that I need before coding. My program may be
a one-off so my card definition is never used elsewhere. If I suspect
that it reasonably might be reused, then I will look more generally
for that definition. At some point though, it is better to decide on
something and run with it.
>Can we also agree that any system needs a starting point and a good
>starting point might be a name that seems to capture at least part of
>what our system is supposed to do.
>
>If we agree on these few simple principles then I'd be interested to
>know what name you might use for your starting point if not PlayingCard
>(or Card).
I would not bother. Determining the name comes as part of the
design. I might even have more than one name because I might have to
handle special cases.
>I can't think of a card game that does not use PlayingCards of one sort
>or another. One might argue that Tarot is not a game yet uses Cards.
>This might mean that PlayingCard is unsuitable, so we fall back to Card
>with PlayingCard a possible later specialization.
That depends on your definition of the term. If you mean the
run-of-the-garden 52-54 or so card deck, I can think of some easily.
Gang of Four is one example.
>If the base abstraction is not Card then what else might describe what a
>Card is better than 'Card'
Who knows yet? That is what the analysis and design are for.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-12-19 13:35 -0800 |
| Message-ID | <3653fada-0e69-4e98-afdc-8cc2b7b25602@googlegroups.com> |
| In reply to | #20513 |
lipska the kat wrote: > I can't think of a card game that does not use PlayingCards of one sort By definition. Hardly a ground-shaking point. > or another. One might argue that Tarot is not a game yet uses Cards. Tarot is not a game because it's the name of the deck. There are games that use Tarot cards, and many decks that are based more directly on Tarot than the French deck that seems to be your imprinted standard. > This might mean that PlayingCard is unsuitable, so we fall back to Card Whatever. What do you do with Tarot cards that is not a game, hm? > with PlayingCard a possible later specialization. > If the base abstraction is not Card then what else might describe what a > Card is better than 'Card' Do you have a point here? Why do you refer to "the" base abstraction? The "base abstraction" of what? There are several such in a card-game simulation. The "base abstraction" of a playing card is the abstract notion of a playing card, as you say. So? Once you break out of tautologies you can find the entrance to design. The key in O-O is not finding one "base abstraction" (BTW, what exactly do you mean by that phrase?) but a cooperating set of them, and identifying the interactions. So to model a card game, you need several types in the model. One approach will comprise 'PlayingCard', 'Rule', 'CardGame', 'Deck', 'Shoe' and other semantic features. It is the interaction of these that makes up a model. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Leif Roar Moldskred <leifm@dimnakorr.com> |
|---|---|
| Date | 2012-12-19 15:55 -0600 |
| Message-ID | <VtadnSIM_7l8qk_NnZ2dnUVZ8lCdnZ2d@giganews.com> |
| In reply to | #20513 |
lipska the kat <lipskathekat@yahoo.co.uk> wrote: > I can't think of a card game that does not use PlayingCards of one sort > or another. Uno and Memory are the classic ones that spring to mind. There's also all the collectible card games, with Magic the Gathering and Pokemon as the two best known ones, and there's a fashion to make "board-less" boardgames consisting only of various cards (Dominion by Donald X. Vaccarino is a really good such game.) (This is just meant as trivia, not a contribution to the technical discussion. It doesn't make sense to try and design a domain model that encompasses both classic playing cards and Magic the Gathering -- the domains are only superficially similar.) -- Leif Roar Moldskred
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-12-19 14:01 -0800 |
| Message-ID | <aacdfe21-3816-46ce-a104-4ec5b90774b4@googlegroups.com> |
| In reply to | #20599 |
Leif Roar Moldskred wrote: > lipska the kat wrote: >> I can't think of a card game that does not use PlayingCards of one sort >> or another. > > > > Uno and Memory are the classic ones that spring to mind. There's also I'm not familiar with Memory, but Uno most certainly does use playing cards. > all the collectible card games, with Magic the Gathering and Pokemon > as the two best known ones, and there's a fashion to make "board-less" > boardgames consisting only of various cards (Dominion by Donald > X. Vaccarino is a really good such game.) All those are games that use playing cards. > (This is just meant as trivia, not a contribution to the technical > discussion. It doesn't make sense to try and design a domain model > that encompasses both classic playing cards and Magic the Gathering -- > the domains are only superficially similar.) But both do involve playing cards. Just different kinds. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Leif Roar Moldskred <leifm@dimnakorr.com> |
|---|---|
| Date | 2012-12-19 16:05 -0600 |
| Message-ID | <VtadnV0M_7m6p0_NnZ2dnUVZ8lCdnZ2d@giganews.com> |
| In reply to | #20600 |
Lew <lewbloch@gmail.com> wrote: > > I'm not familiar with Memory, but Uno most certainly does use playing cards. Ah, my bad. I see I misread the post I was replying too. -- Leif Roar Moldskred
[toc] | [prev] | [next] | [standalone]
| From | Patricia Shanahan <pats@acm.org> |
|---|---|
| Date | 2012-12-19 04:06 -0800 |
| Message-ID | <5dmdnU7yCZQ1MEzNnZ2dnUVZ_sidnZ2d@earthlink.com> |
| In reply to | #20505 |
On 12/18/2012 6:07 PM, Eric Sosman wrote: ... > Yes. But my principal point in all of this is that it cannot > always be implemented in *simple* code. Given the variety of card > games, it is folly to try to capture the notion of "card" in a > single, game-independent way. The same holds true for many other > problem domains as well: It is fruitless to model "a card" or > "a stock market" or "a person" in isolation from the model in > which the card/market/person will be represented. I think there are a lot of games based on mass produced packs of playing cards. That gives a solid basis for a class Card. It should not be Comparable because there is no common ordering. Each game would need its own Comparator<Card>, assuming cards can be compared in the game. It would also need its own value of Deck, a collection of cards that is used in that game. Patricia
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <lipskathekat@yahoo.co.uk> |
|---|---|
| Date | 2012-12-19 12:24 +0000 |
| Message-ID | <RKudnUSPeaB_LEzNnZ2dnUVZ8rKdnZ2d@bt.com> |
| In reply to | #20518 |
On 19/12/12 12:06, Patricia Shanahan wrote: > On 12/18/2012 6:07 PM, Eric Sosman wrote: > ... >> Yes. But my principal point in all of this is that it cannot >> always be implemented in *simple* code. Given the variety of card >> games, it is folly to try to capture the notion of "card" in a >> single, game-independent way. The same holds true for many other >> problem domains as well: It is fruitless to model "a card" or >> "a stock market" or "a person" in isolation from the model in >> which the card/market/person will be represented. > > I think there are a lot of games based on mass produced packs of playing > cards. That gives a solid basis for a class Card. It should not be > Comparable because there is no common ordering. > > Each game would need its own Comparator<Card>, assuming cards can be > compared in the game. It would also need its own value of Deck, a > collection of cards that is used in that game. To progress the design a little I'd suggest that maybe, Card is an abstract class that exposes (at least) two methods, show() and hide(); The default implementations do nothing. I can't think of a card game that doesn't do at least one of these. I can also see Pack which contains n Card[s] depending on type (54 hcds cards is one pack I can think of) and also Deck which contains a number of Cards required to play the game, at this point the 'rules' are irrelevant. The contents of Pack and Deck may be the same for some games, in this case Deck has a constructor that takes a Pack, semantically however they are different. lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-12-19 13:36 -0800 |
| Message-ID | <49e90a16-3d52-415c-b3c7-1e15b8c3eeca@googlegroups.com> |
| In reply to | #20518 |
On Wednesday, December 19, 2012 4:06:14 AM UTC-8, Patricia Shanahan wrote: > Each game would need its own Comparator<Card>, assuming cards can be > compared in the game. It would also need its own value of Deck, a > collection of cards that is used in that game. Except, as pointed out upthread, the semantics of 'Comparator' are not a good match for many card games such as Blackjack or ones that use wild cards. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-18 20:10 -0500 |
| Message-ID | <50d11405$0$290$14726298@news.sunsite.dk> |
| In reply to | #20456 |
On 12/18/2012 12:23 PM, Patricia Shanahan wrote: > On 12/18/2012 9:13 AM, Gene Wirchenko wrote: >> On Tue, 18 Dec 2012 08:53:58 -0500, Eric Sosman >> <esosman@comcast-dot-net.invalid> wrote: >> >>> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: >> >> [snip] >> >>>> And how would you handle the aces? >>>> >>>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>>> five-high straight). >>> >>> In some "high-low" games, A-5-4-3-2 can be both a >>> five-high straight *and* an Ace with four low cards, >>> possibly winning both the "high" and "low" shares of >>> the pot. >> >> Right. I have rarely ever played high-low and forgot about them. >> Does anyone else have an exception to ambush us with? <g> > > I think that sort of issue could be handled by having game-dependent > Comparator<Card,Card> implementations, rather than making Card Comparable. > > I would be more concerned about jokers, which do not follow the > (suit,value) pattern. An abstract Card class with two sub classes RegularCard and Joker?? Arne
[toc] | [prev] | [next] | [standalone]
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Date | 2012-12-18 12:14 -0600 |
| Message-ID | <kaqbqg$l51$1@dont-email.me> |
| In reply to | #20453 |
On 12/18/2012 11:13 AM, Gene Wirchenko wrote: > On Tue, 18 Dec 2012 08:53:58 -0500, Eric Sosman > <esosman@comcast-dot-net.invalid> wrote: > >> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: > > [snip] > >>> And how would you handle the aces? >>> >>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>> five-high straight). >> >> In some "high-low" games, A-5-4-3-2 can be both a >> five-high straight *and* an Ace with four low cards, >> possibly winning both the "high" and "low" shares of >> the pot. > > Right. I have rarely ever played high-low and forgot about them. > Does anyone else have an exception to ambush us with? <g> In the card game "capitalism," the highest card is a 2. ISTR a variant where the highest card is a 3 as well.... -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-18 20:04 -0500 |
| Message-ID | <50d112a1$0$283$14726298@news.sunsite.dk> |
| In reply to | #20429 |
On 12/18/2012 12:10 AM, Gene Wirchenko wrote: > On Mon, 17 Dec 2012 21:28:07 -0500, Arne Vajhøj <arne@vajhoej.dk> > wrote: > >> On 12/17/2012 9:18 PM, Gene Wirchenko wrote: >>> On Mon, 17 Dec 2012 20:55:21 -0500, Arne Vajhøj <arne@vajhoej.dk> >>> wrote: >>> >>> [snip] >>> >>>> 13 distinct values with an order but no numeric values >>>> seems a perfect fit for enum to me. >>> >>> An enum does not guarantee an order. >> >> In the Java I use enums have a compareTo method. > > And how would you handle the aces? > > A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a > five-high straight). That does not relate to whether Java enum has an order or not. But anyway - even with a natural order, then a game specific ordering can be allowed. Arne
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2012-12-19 10:14 -0800 |
| Message-ID | <8u04d8dua5rrdshc39ut9ar4lc682hb15u@4ax.com> |
| In reply to | #20491 |
On Tue, 18 Dec 2012 20:04:31 -0500, Arne Vajhøj <arne@vajhoej.dk>
wrote:
>On 12/18/2012 12:10 AM, Gene Wirchenko wrote:
[snip]
>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a
>> five-high straight).
>
>That does not relate to whether Java enum has an order
>or not.
>
>But anyway - even with a natural order, then a game
>specific ordering can be allowed.
My point is that, in this case, there would be more than one
order.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-19 19:18 -0500 |
| Message-ID | <50d25949$0$286$14726298@news.sunsite.dk> |
| In reply to | #20569 |
On 12/19/2012 1:14 PM, Gene Wirchenko wrote: > On Tue, 18 Dec 2012 20:04:31 -0500, Arne Vajhøj <arne@vajhoej.dk> > wrote: > >> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: > > [snip] > >>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>> five-high straight). >> >> That does not relate to whether Java enum has an order >> or not. >> >> But anyway - even with a natural order, then a game >> specific ordering can be allowed. > > My point is that, in this case, there would be more than one > order. Yes, but game specific order will be provided by game while natural order is provided by card. Arne
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <lipskathekat@yahoo.co.uk> |
|---|---|
| Date | 2012-12-20 11:05 +0000 |
| Message-ID | <hZOdncZY0YyUbE_NnZ2dnUVZ8iidnZ2d@bt.com> |
| In reply to | #20603 |
On 20/12/12 00:18, Arne Vajhøj wrote: > On 12/19/2012 1:14 PM, Gene Wirchenko wrote: >> On Tue, 18 Dec 2012 20:04:31 -0500, Arne Vajhøj <arne@vajhoej.dk> >> wrote: >> >>> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: >> >> [snip] >> >>>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>>> five-high straight). >>> >>> That does not relate to whether Java enum has an order >>> or not. >>> >>> But anyway - even with a natural order, then a game >>> specific ordering can be allowed. >> >> My point is that, in this case, there would be more than one >> order. > > Yes, but game specific order will be provided by game while > natural order is provided by card. I've been reading this thread from day 1 and I have to say the fug is beginning to clear. It appears that what you are proposing is a 'bottom-up' design process. I guess you expect and hope that 'Objects' will automagically appear when the time is right. The original post is dated 16th Dec 2012 it is now the 20th and how much progress has been made. I think the main problem is that that there is no clear statement of requirements. I'll try to interpret the OPs slightly vague requirements to get something concrete down, this is obviously a first pass and will need work so comments welcome. A system is required that will allow one or more players to play a game of cards. A game of cards consists of one or more packs of cards or a subset of one or more packs of cards (hereafter referred to as a deck) a set of rules, and one or more players. Users of the system will be able to choose from a selection of games and the system should be able to support new games as required. I'll make a first pass top down analysis and suggest that Game, Card, Player, Pack, Rule and Deck might be useful abstractions. lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-27 21:43 -0500 |
| Message-ID | <50dd0758$0$295$14726298@news.sunsite.dk> |
| In reply to | #20625 |
On 12/20/2012 6:05 AM, lipska the kat wrote: > On 20/12/12 00:18, Arne Vajhøj wrote: >> On 12/19/2012 1:14 PM, Gene Wirchenko wrote: >>> On Tue, 18 Dec 2012 20:04:31 -0500, Arne Vajhøj <arne@vajhoej.dk> >>> wrote: >>> >>>> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: >>> >>> [snip] >>> >>>>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>>>> five-high straight). >>>> >>>> That does not relate to whether Java enum has an order >>>> or not. >>>> >>>> But anyway - even with a natural order, then a game >>>> specific ordering can be allowed. >>> >>> My point is that, in this case, there would be more than one >>> order. >> >> Yes, but game specific order will be provided by game while >> natural order is provided by card. > > I've been reading this thread from day 1 and I have to say the fug is > beginning to clear. It appears that what you are proposing is a > 'bottom-up' design process. I guess you expect and hope that 'Objects' > will automagically appear when the time is right. ???? I don't think the fog is clearing. I am mostly for top-down design not bottom-up design. That a game specific comparator belongs in the game and not the card class has nothing to do with top-down versus bottom-up. Arne
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-12-27 18:49 -0800 |
| Message-ID | <010b1b3c-ea0a-4fb9-9cd8-2c77b8238fa2@googlegroups.com> |
| In reply to | #20740 |
Arne Vajhøj wrote: > lipska the kat wrote: >> I've been reading this thread from day 1 and I have to say the fug is >> beginning to clear. It appears that what you are proposing is a >> 'bottom-up' design process. I guess you expect and hope that 'Objects' >> will automagically appear when the time is right. > > ???? > > I don't think the fog is clearing. > > I am mostly for top-down design not bottom-up design. > > That a game specific comparator belongs in the game and > not the card class has nothing to do with top-down > versus bottom-up. The inclusion of quotes around the terms "bottom-up" and "Objects" by the OP raises suspicions that there is some alternative use of the terms in play here. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2012-12-27 22:10 -0500 |
| Message-ID | <50dd0d93$0$291$14726298@news.sunsite.dk> |
| In reply to | #20742 |
On 12/27/2012 9:49 PM, Lew wrote: > Arne Vajhøj wrote: >> lipska the kat wrote: >>> I've been reading this thread from day 1 and I have to say the fug is >>> beginning to clear. It appears that what you are proposing is a >>> 'bottom-up' design process. I guess you expect and hope that 'Objects' >>> will automagically appear when the time is right. >> >> ???? >> >> I don't think the fog is clearing. >> >> I am mostly for top-down design not bottom-up design. >> >> That a game specific comparator belongs in the game and >> not the card class has nothing to do with top-down >> versus bottom-up. > > The inclusion of quotes around the terms "bottom-up" and "Objects" by the OP > raises suspicions that there is some alternative use of the terms in play here. I must admit that I did not understand the "and hope that 'Objects' will automagically appear when the time is right" part at all. Neither "eventually some code will be done so objects can be instantiated" nor "start with specialized classes and find super classes until Object is reached" seems to relate to the rest. Arne
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2012-12-20 09:01 -0800 |
| Message-ID | <vvg6d8hdfsnse7c1h2lde2b275hgc3tjnb@4ax.com> |
| In reply to | #20603 |
On Wed, 19 Dec 2012 19:18:16 -0500, Arne Vajhøj <arne@vajhoej.dk>
wrote:
[snip]
>> My point is that, in this case, there would be more than one
>> order.
>
>Yes, but game specific order will be provided by game while
>natural order is provided by card.
Try game-specific order*S*.
What natural order? And how do you just the use of the word
"natural"? "preferred" might be a better choice of words.
And why would a card provide an order anyway? Order is a
property of a deck, not a card.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Patricia Shanahan <pats@acm.org> |
|---|---|
| Date | 2012-12-20 09:30 -0800 |
| Message-ID | <A56dnXmOV6Sx1k7NnZ2dnUVZ_q6dnZ2d@earthlink.com> |
| In reply to | #20630 |
On 12/20/2012 9:01 AM, Gene Wirchenko wrote: > On Wed, 19 Dec 2012 19:18:16 -0500, Arne Vajhøj <arne@vajhoej.dk> > wrote: > > [snip] > >>> My point is that, in this case, there would be more than one >>> order. >> >> Yes, but game specific order will be provided by game while >> natural order is provided by card. > > Try game-specific order*S*. > > What natural order? And how do you just the use of the word > "natural"? "preferred" might be a better choice of words. > > And why would a card provide an order anyway? Order is a > property of a deck, not a card. Outside a specific game, what is the proper default for ace-high vs. ace-low, and where do you put the jokers, the NaNs of playing cards? Perhaps more importantly, why do we need an order? Patricia
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@telus.net> |
|---|---|
| Date | 2012-12-20 13:35 -0800 |
| Message-ID | <3h07d81eh28qlu7q8v5fp7ugse6e2u45s3@4ax.com> |
| In reply to | #20632 |
On Thu, 20 Dec 2012 09:30:09 -0800, Patricia Shanahan <pats@acm.org>
wrote:
[snip]
>Outside a specific game, what is the proper default for ace-high vs.
>ace-low, and where do you put the jokers, the NaNs of playing cards?
"the NaNs of playing cards": a nice turn of phrase, madam!
That is even better than Gang of Four's rules which have that the
green phoenix is not a green card, the yellow phoenix is not a yellow
card, and the red dragon is not a red card. OTOH, the multi-coloured
one can be stated to be any of the colours for the purpose of flushes
and straight flushes.
>Perhaps more importantly, why do we need an order?
Many card games require order to rank hands or determine which
card beats which.
I want to see a game where the ranking is circular. There would
be no ties on two different-value cards if the number of values in the
circle is odd.
Implement with computing the normal difference in values. If
this number is six or less, the nominally higher card would be ranked
higher; otherwise, the nominally lower card would be ranked higher.
Example: An ace would beat a king, queen, jack, ten, nine, or eight
and lose to a two, three, four, five, six, or seven.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
Page 2 of 5 — ← Prev page 1 [2] 3 4 5 Next page →
Back to top | Article view | comp.lang.java.programmer
csiph-web