Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Wall Class

You hould also define a Mah Jongg Wall class which holds the initial set of 136 tiles. We can create additional subclasses to add as many as a dozen more tiles to include jokers, flowers and seasons.

The Wall will need an __init__ that enumerates four copies of each of the following tiles: the twenty-seven combinations of each suit (dot, bamboo, and character) and each rank (one through nine). It also needs to enumerate four copies of each honor tile (east, south, west, north, red, white, green).

In addition to creating the set of tiles, this class will need methods to shuffle and deal. In this way the wall is nearly identical with a deck of playing cards. See the section called “Advanced Class Definition Exercises” for more guidance on this class design.

Build The Wall Class. Second, build the Wall. Write a short test that will be sure that it shuffles and deals tiles properly.


 
 
  Published under the terms of the Open Publication License Design by Interspire