main.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // main.cpp
  3. // auto_fill_jewel_v3
  4. //
  5. // Created by Red on 2024/11/22.
  6. //
  7. /*
  8. 需求:
  9. 1.给定宝石种类和每类数量
  10. 2.程序随机给出5种盘子组合
  11. 3.关卡由多个盘子组成,每个盘子包含若干不同层,每层上面包含宝石。
  12. 4.宝石有大、中、小三个尺度,按面积算: 1大=2中=4小
  13. 5.盘子有大、小、迷你3种,其容量分别对应 6个大宝石,3个大宝石,1个大宝石。(确认没有中盘子)
  14. 6.每个关卡最大有9个大盘子。
  15. 7.盘子之间的层数差异在0-1个。迷你盘子数量可以很多,这个是不是需要人工控制后面再问吧。
  16. 8.盘子会移动,但是盘子间不会重叠。
  17. 9.大中小号盘子有横的有竖着的。
  18. 10.重叠区百分比可以从0.05到0.2,程序自行判断最优值。
  19. 11.宝石只提供 80x80的资源,对应大。如果有中和小,需要程序缩放(0.75,0.50)。大、中、小是不同的宝石各消各的。
  20. */
  21. #include <iostream>
  22. #include <string>
  23. #include <vector>
  24. #include "SpriteData.hpp"
  25. #include "ajson5.hpp"
  26. #include "contourdata.h"
  27. #include "LevelGenerate.hpp"
  28. #include "FillGlobalConfig.hpp"
  29. #include "RandomGridFiller.hpp"
  30. #include "BoostGeometryTools.hpp"
  31. #include <opencv2/core.hpp>
  32. #include <opencv2/imgproc.hpp>
  33. #include <opencv2/highgui.hpp>
  34. #include <sstream>
  35. #include <ctime>
  36. #include <chrono>
  37. #include <tuple>
  38. #include <sstream>
  39. using namespace ArduinoJson;
  40. using namespace std;
  41. int main(int argc, const char * argv[]) {
  42. cout<<"A program to generate level. 2024-11-23"<<endl;
  43. cout<<"usage:auto_fill_jewel_v3"<<endl;
  44. cout<<"version v3.0"<<endl ;
  45. FillGlobalConfig::getInstance() ; //inited
  46. FillGlobalConfig::LevelData* level100_1 = FillGlobalConfig::getInstance()->getLevelData(100, 0) ;
  47. LevelGenerate genv3 ;
  48. genv3.generateAll(*level100_1, "sg_level_out_100-1.json") ;
  49. return 0;
  50. }