I am attempting to do some game theory models for the collectible card game Legend of the Five Rings (www.l5r.com). The problem I am having is Polymorphisms, Inheritance, and Constructors in Maple 10. The game consists of several Card Types, each with distinct characteristics. I want to define a construtor module called CARD. It will have a TITLE and along with procedures getTitle() and setTitle(String). I then want to have a constructor module called HOLDING that is a CARD and has all the characteristic and procedures of CARD, but also a variable GOLDPRODUTION and procedures getGoldProduction and setGoldProduction. I have attempted to do this entirely encapselated in the CARD module and here is a bit of the code that I have so far: Card:=module() export ModuleApply: option package: ModuleApply:=proc(Type) local Title,p: Title:="Generic": if (Type = "Holding") then p:=module() option package: export SetGP,GetGP,SetTitle,GetTitle: local GP: GP:=0: GetGP:=proc() return GP: end proc: SetGP:=proc(g) GP:=g: end proc: SetTitle:=proc(S) Title:=S end proc: GetTitle:=proc() return Title: end proc: end module: fi: return p: end proc: end module: I don't like this though as I have to cut and paste the procedures SetTitle(), GetTitle() into every conditional statement of every type of card. Is there a better way?

Please Wait...