Chapter 4: More OOPing Around - Learn VB .NET Through Game Programming [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Learn VB .NET Through Game Programming [Electronic resources] - نسخه متنی

Matthew Tagliaferri

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید





Chapter 4: More OOPing Around


Overview


Inheritance is a Powerful Concept, and you can use it in many different ways to solve a problem. However, inheritance can also be misused, or used in the wrong way. Such misuse can lead to overly complex solutions or ones that don’t scale well. This chapter demonstrates this type of poor design choice.

The three games in this chapter use a game element called a tile, a small square piece containing one of four shapes—a square, a circle, a triangle, or adiamond. A shape can be one of four colors—red, blue, yellow, or green. Figure 4-1 shows each of the four shapes.


Figure 4-1: The four colored shapes used in this chapter’s games

Without getting into too much detail too soon, the following list introduces the three games so you can see how the design of the Tile class might affect them:


Brain Drain Concentration: This is the standard “memory game,” where users flip over tiles to find two that match. There are 32 tiles—two of each color/shape combination (four colors and four shapes make 16 possibilities, and two of each possibility makes 32 total). Users can also play a “double game,” where there are four possibilities of each, making 64 total tiles.

DeducTile Reasoning: This game creates a puzzle of four tiles. Each shape and each color is represented only once in the puzzle. Clues are then given as to the orientation and position of the four tiles. The player must order the tiles into the correct orientation based on clues.

Lose Your Mind: A variant of Mastermind, this game creates a puzzle of four tiles, each having any shape or color (duplicates allowed). After the player guesses, hints are given as to how many correct shapes and colors appear in the proper locations and how many correct shapes and colors appear in the wrong locations. The variation from traditional Mastermind is that the player is really solving two puzzles at the same time—one for the shapes and one for the colors.


/ 106