- Main Page
- Classes
- Files

- File List

# OptFrame/Examples/EternityII/ProblemInstance.hpp

    00001 #ifndef EtII_PROBLEMINSTANCE_HPP_
    00002 #define EtII_PROBLEMINSTANCE_HPP_
    00003
    00004 #include <iostream>
    00005
    00006 #include "../../../OptFrame/Util/Scanner++/Scanner.h"
    00007
    00008 #include "Piece.h"
    00009
    00010 using namespace std;
    00011
    00012 class EtIIProblemInstance
    00013 {
    00014 public:
    00015         vector<Piece> pieces;
    00016         int width, height;
    00017
    00018         EtIIProblemInstance(Scanner& scanner)
    00019         {
    00020                 cout << "Reading problem instance" << endl;
    00021                 width = scanner.nextInt();
    00022                 height = scanner.nextInt();
    00023
    00024                 cout << "width = " << width << "; height = " << height << ";" << endl;
    00025                 cout << "pieces" << endl;
    00026
    00027                 pieces.clear();
    00028                 int numPieces = width * height;
    00029
    00030                 for (int i = 0; i < numPieces; i++)
    00031                 {
    00032                         cout << i << ": ";
    00033
    00034                         int down = scanner.nextInt();
    00035                         int left = scanner.nextInt();
    00036                         int up = scanner.nextInt();
    00037                         int right = scanner.nextInt();
    00038
    00039                         Piece& p = *new Piece(down, left, up, right, i, 0);
    00040
    00041                         cout << p << endl;
    00042
    00043                         pieces.push_back(p);
    00044                 }
    00045         }
    00046 };
    00047
    00048 #endif /*EtII_PROBLEMINSTANCE_HPP_*/
    00049

All Classes Functions