test-bin/test-personobj.cxx

00001 // This program is free software; you can redistribute it and/or modify
00002 // it under the terms of the GNU General Public License as published by
00003 // the Free Software Foundation; either version 2 of the License, or
00004 // (at your option) any later version.
00005 // 
00006 // This program is distributed in the hope that it will be useful,
00007 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00008 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009 // GNU Library General Public License for more details.
00010 // 
00011 // You should have received a copy of the GNU General Public License
00012 // along with this program; if not, write to the Free Software
00013 // Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
00014 
00015 #include "b1-navy-person.hpp"
00016 #include "b1-army-person.hpp"
00017 #include "b1-marine-person.hpp"
00018 #include "book1-person.hpp"
00019 #include "b1-merchant-person.hpp"
00020 
00021 #include <iostream>
00022 #include "dice.hpp"
00023 
00024 book1Person* getNewPerson(int flip){
00025         switch(flip){
00026                 case 1:
00027                 case 2:
00028                         return new b1NavyPerson();
00029                 case 3:
00030                   return new b1MerchantPerson();
00031                 case 4:
00032                         return new b1MarinePerson();
00033                 case 5:
00034                         return new b1MerchantPerson();
00035                 case 6:
00036                         return new b1ArmyPerson();
00037         };
00038         
00039                 
00040 }
00041 
00042 void generateTest(){
00043         int ix;
00044         int iy;
00045         
00046         for(iy=0;iy<25;iy++){
00047                 
00048                 int flip = d1d6();
00049                 
00050                 book1Person *person;
00051                 
00052                  person= getNewPerson(flip);
00053                 while ( (person->getAccepted() != 1) || (person->getAlive() != 1) ) {
00054                         person = getNewPerson(flip);;
00055                 }
00056                 
00057                 person->toStdOut();
00058                 std::cout << std::endl << std::endl;
00059                 
00060         }
00061 }
00062 
00063 int main()
00064 {
00065         generateTest();
00066         return 0;
00067 }
00068 
00069  

Generated on Fri Mar 7 16:40:53 2008 for frpuniverse by  doxygen 1.4.7