Nenhuma descrição

main.cpp 896B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <QApplication>
  2. #include "maingamewindow.h"
  3. #include <cmath>
  4. int main(int argc, char *argv[]) {
  5. QApplication a(argc, argv);
  6. //MainGameWindow *w = new MainGameWindow(4,2);
  7. //MainGameWindow *w = new MainGameWindow("xx x\nxx x\nx xx\n");
  8. MainGameWindow *w = new MainGameWindow(Mode::SQUARE_TOP_LEFT);
  9. w->show();
  10. while (w->canMove('W'))
  11. w->moveRobot('W');
  12. while (w->canMove('N'))
  13. w->moveRobot('N');
  14. //w->moveRobot('N');
  15. int width = 1;
  16. w->display(width);
  17. while (w->canMove('E')) {
  18. width++;
  19. w->moveRobot('E');
  20. w->display(width);
  21. }
  22. int height = 1;
  23. w->display(height);
  24. while (w->canMove('S')) {
  25. height++;
  26. w->moveRobot('S');
  27. w->display(height);
  28. }
  29. w->display("Total: " + QString::number(width * height));
  30. w->moveRobot('J');
  31. return a.exec();
  32. }