#define OLC_PGE_APPLICATION #include "pixelGameEngine.h" #include "olcutils.h" #include using namespace olc; int main() { std::ifstream file("input"); std::vector>playfieldRows; std::array,4>piece{{ {' ',' ',' ',' '}, {' ',' ',' ',' '}, {' ',' ',' ',' '}, {' ',' ',' ',' '}}}; vi2d piecePos={0,0}; std::array,4>,vi2d>,5>pieces{{ {{{{'#','#','#','#'}, {' ',' ',' ',' '}, {' ',' ',' ',' '}, {' ',' ',' ',' '}}},{4,1}}, {{{{' ','#',' ',' '}, {'#','#','#',' '}, {' ','#',' ',' '}, {' ',' ',' ',' '}}},{3,3}}, {{{{' ',' ','#',' '}, {' ',' ','#',' '}, {'#','#','#',' '}, {' ',' ',' ',' '}}},{3,3}}, {{{{'#',' ',' ',' '}, {'#',' ',' ',' '}, {'#',' ',' ',' '}, {'#',' ',' ',' '}}},{1,4}}, {{{{'#','#',' ',' '}, {'#','#',' ',' '}, {' ',' ',' ',' '}, {' ',' ',' ',' '}}},{2,2}},}}; int currentPiece=0; int topRow=0; int jetMarker=0; while (file.good()){ std::string line; std::getline(file,line); if (line.length()>0){ std::cout<,4>,vi2d>piece=pieces[currentPiece]; currentPiece=(currentPiece+1)%5; int newRows=3-topRow+piece.second.y; //std::cout<<"Adding "<0){ for (int j=0;jnewRow={' ',' ',' ',' ',' ',' ',' '}; playfieldRows.insert(playfieldRows.begin(),newRow); topRow++; } piecePos={2,0}; } else { piecePos={2,topRow-3-piece.second.y}; } while (!pieceLanded) { char direction=line[jetMarker]; //std::cout<0){ for (int yy=0;yy':{ if (piecePos.x+piece.second.x<7){ for (int yy=0;yy=piecePos.x&&y>=piecePos.y&&x-1