diff --git a/C++ProjectTemplate b/C++ProjectTemplate index c1aa29d..66bd240 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/input b/input new file mode 100644 index 0000000..5659493 --- /dev/null +++ b/input @@ -0,0 +1,137 @@ +476,63 -> 481,63 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +500,146 -> 505,146 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +498,68 -> 502,68 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +494,65 -> 499,65 +495,71 -> 499,71 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +487,65 -> 492,65 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +506,142 -> 511,142 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +483,63 -> 488,63 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +517,139 -> 522,139 +495,77 -> 499,77 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +498,74 -> 502,74 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +504,74 -> 508,74 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +486,80 -> 490,80 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,139 -> 515,139 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +490,63 -> 495,63 +516,151 -> 516,152 -> 527,152 -> 527,151 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +513,136 -> 518,136 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +492,74 -> 496,74 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +492,80 -> 496,80 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +474,55 -> 474,56 -> 484,56 +482,59 -> 487,59 +480,65 -> 485,65 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +473,65 -> 478,65 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +506,136 -> 511,136 +498,80 -> 502,80 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +516,151 -> 516,152 -> 527,152 -> 527,151 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,144 -> 515,144 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +514,146 -> 519,146 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +489,25 -> 489,26 -> 504,26 -> 504,25 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +501,71 -> 505,71 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +474,55 -> 474,56 -> 484,56 +489,25 -> 489,26 -> 504,26 -> 504,25 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +500,129 -> 500,130 -> 511,130 +495,104 -> 495,108 -> 488,108 -> 488,112 -> 500,112 -> 500,108 -> 498,108 -> 498,104 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +509,133 -> 514,133 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +500,129 -> 500,130 -> 511,130 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +489,96 -> 489,98 -> 482,98 -> 482,101 -> 496,101 -> 496,98 -> 494,98 -> 494,96 +516,151 -> 516,152 -> 527,152 -> 527,151 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +503,139 -> 508,139 +479,61 -> 484,61 +503,144 -> 508,144 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +507,77 -> 511,77 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +489,25 -> 489,26 -> 504,26 -> 504,25 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +507,146 -> 512,146 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +510,80 -> 514,80 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +486,61 -> 491,61 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +501,77 -> 505,77 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +487,29 -> 487,33 -> 480,33 -> 480,37 -> 499,37 -> 499,33 -> 491,33 -> 491,29 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +497,13 -> 497,17 -> 495,17 -> 495,21 -> 509,21 -> 509,17 -> 501,17 -> 501,13 +496,125 -> 496,117 -> 496,125 -> 498,125 -> 498,119 -> 498,125 -> 500,125 -> 500,120 -> 500,125 -> 502,125 -> 502,118 -> 502,125 -> 504,125 -> 504,124 -> 504,125 +504,80 -> 508,80 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 +474,50 -> 474,42 -> 474,50 -> 476,50 -> 476,42 -> 476,50 -> 478,50 -> 478,46 -> 478,50 -> 480,50 -> 480,45 -> 480,50 -> 482,50 -> 482,44 -> 482,50 +510,165 -> 510,155 -> 510,165 -> 512,165 -> 512,160 -> 512,165 -> 514,165 -> 514,161 -> 514,165 -> 516,165 -> 516,158 -> 516,165 -> 518,165 -> 518,157 -> 518,165 +489,77 -> 493,77 +478,93 -> 478,87 -> 478,93 -> 480,93 -> 480,90 -> 480,93 -> 482,93 -> 482,83 -> 482,93 -> 484,93 -> 484,88 -> 484,93 -> 486,93 -> 486,83 -> 486,93 -> 488,93 -> 488,90 -> 488,93 -> 490,93 -> 490,87 -> 490,93 diff --git a/main.cpp b/main.cpp index 8ab7e53..c573d4d 100644 --- a/main.cpp +++ b/main.cpp @@ -4,86 +4,124 @@ using namespace olc; -class Example : public olc::PixelGameEngine -{ -public: - Example() - { - sAppName = "Example"; - } - -public: - bool RayVsRect(const vf2d ray_origin, const vf2d ray_dir, const olc::utils::geom2d::rect target, vf2d&contact_point, vf2d&contact_normal, float&t_hit_near){ - - contact_normal = { 0, 0 }; - contact_point = { 0, 0 }; - vf2d t_near = {(target.pos.x - ray_origin.x) / ray_dir.x, (target.pos.y - ray_origin.y) / ray_dir.y}; - vf2d t_far = {(target.pos.x + target.size.x - ray_origin.x) / ray_dir.x, (target.pos.y + target.size.y - ray_origin.y) / ray_dir.y}; +vi2d upperLeftCoords={500,0}; +vi2d lowerRightCoords={500,0}; +std::vector>board; - if (t_near.x > t_far.x) {float b; b = t_near.x; t_near.x = t_far.x; t_far.x = b;}; - if (t_near.y > t_far.y) {float b; b = t_near.y; t_near.y = t_far.y; t_far.y = b;}; - - if (t_near.x > t_far.y || t_near.y > t_far.x) return false; - - t_hit_near = fmax(t_near.x, t_near.y); - float t_hit_far = fmin(t_far.x, t_far.y); +struct Connection{ + std::vectorcoords; +}; - if (t_hit_far < 0) return false; +enum ReadState{ + READX, + READY, + WAIT +}; - contact_point.x = ray_origin.x + t_hit_near * ray_dir.x; - contact_point.y = ray_origin.y + t_hit_near * ray_dir.y; +vi2d getArrayCoords(vi2d pos){ + return pos-upperLeftCoords; +} - if (t_near.x > t_near.y) - if ( 1.0f / ray_dir.x < 0) - contact_normal = { 1, 0 }; - else - contact_normal = { -1, 0}; - else - if ( t_near.x < t_near.y) - if ( 1.0f / ray_dir.y < 0) - contact_normal = { 0, 1 }; - else - contact_normal = { 0, -1 }; - - return true; +void modifyBoard(vi2d pos,char val){ + vi2d actualCoords=getArrayCoords(pos); + board[actualCoords.y][actualCoords.x]=val; +} - +int main() +{ + std::vectorconnections; + std::ifstream file("input"); + ReadState state=READX; + while (file.good()){ + std::string line; + std::getline(file,line); + std::string num1; + std::string num2; + if (line.length()>0){ + state=READX; + Connection c; + for (int i=0;i{originPoint+velocity,5},olc::utils::geom2d::rect{{32,32},{64,32}})) { - originPoint+=velocity; - DrawCircle(originPoint,5); - } else { - DrawCircle(originPoint,5,RED); + for (int y=upperLeftCoords.y;y<=lowerRightCoords.y;y++){ + std::vectorb; + for (int x=upperLeftCoords.x;x<=lowerRightCoords.x;x++){ + b.push_back(' '); } - DrawLine(originPoint,GetMousePos()); - - DrawRect({32,32},{64,32},RayVsRect(originPoint, GetMousePos()-originPoint, olc::utils::geom2d::rect{{32,32},{64,32}},contact_point,contact_normal,t_hit_near)&&t_hit_near<1?YELLOW:WHITE); - return true; - } -}; + board.push_back(b); + } + for(int i=0;i