Every game can be played on a (sufficiently complex) table. Ok, so what's on the table? That's the "Board", or "representation of the game's state". This could be a map, actual board, or how the galaxy looks at a given point in time. Everything that changes the game's state goes through the Board's interface.

Now, within the Board, you have some number of "Piece"s. These are the things that are moved around on the Board. The only hierarchy allowed to touch a Piece is the Board.

Now that you have your gamestate, you need things that change the gamestate. Generally, this is either humans or computers. So, create a connection to some person and, if needed, a connection to some AI "process". These connections will have the same basic interface. Something along the lines of a SetupConnection(), GetMove(), DisplayBoard(), and EndConnection().

After that, it's just data structures to help you make your life easier. For example, if you were building a MUD, you'd have a Thing class. Then, Thing::Alive and Thing::Inanimate would be its children. Then, Thing::Inanimate::Weapon vs. Thing::Inanimate::Armor, and so on. These would be examples of a Piece hierarchy.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.


In reply to Re: Difficulty Abstracting by dragonchild
in thread Difficulty Abstracting by billyak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.