home *** CD-ROM | disk | FTP | other *** search
- integer function somebody_has_won()
- {
- integer germans, americans;
-
- germans := 0;
- americans := 0;
-
- foreach i in tank.get_instances() do
- {
- if i.get_pos("German")=-1 then
- germans := germans + 1;
- else
- americans := americans + 1;
- endif;
- };
-
- if americans=0 then
- write("\n\nThe Germans have won!\n\n");
- return(true);
- else
- if germans=0 then
- write("\n\nThe Americans have won!\n\n");
- return(true);
- else
- return(false);
- endif;
- endif;
- };
-
- null function go()
- {
- cls();
-
- foreach i in tank.get_instances() do
- {
- i.display();
- };
-
- loop
- foreach i in tank.get_instances() do
- {
- i.move();
- };
-
- cls();
-
- foreach i in tank.get_instances() do
- {
- i.display();
- };
-
- exiton( somebody_has_won() );
-
- endloop;
- };
-
- go();
-