Relationship between GUI and logic?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri May 23 09:04:15 EDT 2008


On Fri, 23 May 2008 07:14:08 -0400, inhahe wrote:

> <purelyacademic>If the GUI defines that it's a board layout like chess or 
> checkers and the player will move around the board, it's hard to say what's 
> left for the "logic" part to do.

The logic part has the rules how you may move the pieces.  The GUI
shouldn't have to know how a knight, bishop, or queen can move or
what castling is.

> I can't think of any generalization for the fact that it's a 2D strategy
> game.  You could have a 2-dimensional array, the size of which is
> determined by the GUI,

No it isn't!  The size is independent from the GUI.  Most 2D strategy
games have maps that are way large than the GUI displays at once.  You
almost always see just a portion of the model of the game world in the GUI.

> but even motion on it would have to be defined by the GUI, in which case
> the GUI would simply be using the "logic" part for storing the array and
> accessing it via index values.  And then there's no reason not to put
> the array inside the GUI.

There are plenty of reasons.  You tie the game to one GUI this way.  No
way to change the GUI toolkit or to split the game into server (game
logic) and client (different GUIs, web application).

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list