diff --git a/C++ProjectTemplate b/C++ProjectTemplate index c1aa29d..e7137e5 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/input b/input new file mode 100644 index 0000000..c7fb3fc --- /dev/null +++ b/input @@ -0,0 +1,1000 @@ +48-50,48-49 +5-89,5-5 +17-57,55-96 +24-67,23-25 +89-99,11-89 +34-71,35-71 +13-17,16-95 +13-93,5-12 +11-91,1-11 +4-81,2-11 +53-82,52-53 +5-98,4-97 +4-78,3-3 +20-81,21-80 +79-83,77-82 +76-87,43-87 +14-93,12-62 +13-94,15-95 +22-75,14-53 +67-90,67-79 +1-82,1-82 +5-80,83-96 +28-57,56-56 +53-91,52-54 +21-97,2-36 +8-18,10-98 +7-91,12-91 +11-88,19-95 +22-88,21-88 +31-69,9-48 +2-3,3-43 +5-95,2-6 +5-85,5-79 +51-91,51-69 +41-91,41-64 +23-37,24-95 +1-28,3-94 +6-93,6-98 +8-65,34-66 +2-8,9-38 +3-75,2-4 +40-77,37-76 +51-51,11-51 +95-95,3-94 +90-90,81-90 +26-61,26-61 +1-96,97-98 +41-84,90-91 +94-94,1-94 +52-89,74-90 +9-11,10-74 +57-67,56-62 +29-98,30-78 +20-88,18-54 +11-81,10-82 +85-87,26-86 +8-45,46-78 +16-33,20-49 +73-93,16-93 +35-36,29-36 +4-98,98-98 +24-30,30-80 +64-99,72-97 +8-33,8-47 +88-96,93-99 +23-46,35-49 +41-60,40-41 +5-83,4-6 +76-76,15-76 +37-70,69-71 +11-77,11-12 +57-65,65-97 +20-46,46-62 +76-84,8-77 +10-29,29-53 +16-50,6-17 +20-99,19-19 +11-12,12-72 +24-91,77-92 +37-73,72-73 +50-52,73-89 +37-99,25-76 +1-88,1-2 +18-64,17-63 +19-52,17-52 +5-86,6-87 +13-87,14-87 +23-82,19-92 +56-79,57-79 +25-68,26-67 +5-95,94-96 +38-50,38-39 +32-75,32-75 +23-69,23-69 +25-54,18-25 +33-79,34-67 +38-62,38-65 +62-75,69-78 +2-17,3-17 +12-20,19-96 +7-7,4-8 +1-92,2-93 +29-70,69-77 +7-54,2-54 +9-34,16-34 +4-20,7-31 +4-89,4-47 +12-91,9-96 +8-79,9-80 +32-91,31-91 +1-4,5-55 +85-94,84-95 +73-74,6-74 +51-70,52-70 +21-75,7-27 +13-38,37-39 +42-97,42-98 +33-45,28-45 +12-14,13-98 +91-92,90-91 +66-83,57-83 +8-79,9-67 +59-72,71-72 +33-71,3-33 +13-38,12-38 +18-93,18-52 +28-80,12-26 +87-88,2-88 +7-89,7-85 +26-27,27-27 +12-97,12-97 +36-95,32-91 +25-33,25-32 +4-39,5-75 +40-58,41-58 +8-60,8-93 +9-69,70-70 +19-34,35-68 +47-47,38-47 +1-70,1-70 +39-82,38-83 +17-98,17-99 +56-86,37-56 +2-2,4-96 +5-97,97-97 +52-93,52-77 +39-66,38-66 +9-99,4-99 +25-37,24-37 +2-99,1-98 +13-15,15-15 +10-51,5-9 +38-99,19-96 +6-38,37-78 +94-98,95-99 +8-89,29-89 +2-98,1-98 +13-99,99-99 +1-76,1-25 +8-97,8-97 +9-90,89-93 +24-52,7-49 +30-97,45-99 +26-62,26-59 +15-27,21-30 +80-81,64-80 +65-76,2-76 +9-9,10-99 +3-6,4-82 +78-79,20-79 +11-50,49-49 +10-12,11-68 +1-5,4-85 +8-10,9-95 +16-86,16-87 +11-81,10-11 +36-87,75-87 +55-92,54-99 +3-18,18-84 +4-73,1-2 +16-66,5-76 +29-73,29-79 +60-91,67-91 +82-82,47-82 +31-38,31-37 +44-44,21-44 +93-94,65-94 +13-79,2-12 +4-97,5-97 +40-78,40-41 +69-99,1-69 +8-97,8-96 +27-27,26-79 +60-96,71-88 +24-57,18-25 +1-26,2-27 +53-81,69-81 +3-96,2-96 +9-99,9-97 +45-48,46-56 +6-36,5-30 +45-73,46-73 +28-41,27-42 +4-91,90-94 +6-39,20-44 +3-3,5-65 +17-98,18-65 +15-98,15-96 +29-88,65-90 +10-61,60-62 +26-91,27-91 +78-96,95-95 +6-22,6-17 +40-56,40-57 +4-5,6-98 +78-83,51-83 +8-78,8-78 +26-87,26-86 +4-94,3-4 +5-55,2-6 +40-50,19-56 +55-68,2-94 +39-41,9-40 +68-76,68-69 +51-60,50-59 +9-48,2-10 +13-96,13-63 +1-90,4-91 +1-7,6-99 +25-67,25-66 +13-94,14-93 +27-28,28-70 +39-41,25-40 +8-53,9-53 +56-89,57-88 +4-56,50-56 +22-76,15-17 +7-98,69-76 +12-46,11-46 +1-41,3-72 +43-55,44-76 +9-81,9-81 +45-95,45-94 +12-68,12-69 +90-96,74-85 +67-68,68-68 +50-73,2-73 +6-17,6-97 +70-76,71-99 +9-43,9-43 +9-76,8-75 +66-90,65-66 +13-99,12-14 +1-2,3-91 +53-86,52-53 +3-57,3-96 +81-92,80-92 +6-18,17-88 +70-94,69-69 +17-17,18-88 +4-92,4-93 +41-61,47-61 +25-52,25-73 +78-97,12-97 +39-54,38-46 +39-52,39-58 +8-99,8-51 +52-58,51-52 +5-45,6-46 +3-99,98-98 +84-87,84-98 +58-87,86-88 +6-72,71-73 +41-42,41-86 +27-42,27-77 +14-15,14-74 +43-43,40-43 +17-95,17-93 +44-66,65-70 +4-99,5-99 +43-43,44-86 +64-75,63-71 +4-99,5-99 +6-29,6-99 +19-84,18-83 +72-72,10-72 +9-14,13-88 +3-98,98-98 +9-81,10-81 +13-69,13-70 +3-87,1-87 +22-61,10-62 +75-90,75-90 +69-99,68-87 +94-94,91-95 +2-3,3-96 +5-93,48-93 +43-45,33-49 +85-87,2-86 +51-52,52-62 +50-91,40-49 +1-81,21-81 +51-56,51-56 +22-23,23-37 +25-27,26-67 +58-59,23-58 +37-85,84-85 +12-97,12-96 +14-38,2-13 +33-81,32-44 +34-65,46-60 +3-28,27-28 +11-54,11-55 +2-93,1-93 +28-28,28-50 +10-82,81-83 +77-82,77-82 +33-63,49-63 +2-84,89-91 +37-90,36-91 +46-85,45-85 +97-97,14-97 +5-18,6-19 +7-94,6-95 +17-87,12-86 +11-85,39-85 +7-94,7-93 +9-98,9-96 +18-18,19-96 +62-62,34-62 +24-36,24-91 +72-91,4-91 +7-84,7-83 +9-93,9-87 +22-99,21-99 +32-46,31-32 +32-70,69-97 +13-89,12-88 +10-10,11-89 +46-46,47-64 +51-51,24-52 +5-51,3-3 +46-90,99-99 +6-96,5-95 +50-96,50-97 +96-96,4-70 +13-36,12-35 +19-90,13-20 +12-43,42-95 +1-83,1-84 +3-5,4-70 +24-97,25-98 +27-40,1-50 +37-82,36-83 +47-95,47-94 +2-80,2-58 +64-83,63-87 +42-52,41-44 +26-97,1-97 +35-45,35-78 +6-45,28-82 +11-17,11-16 +67-67,44-67 +2-95,2-94 +22-95,22-94 +20-43,21-92 +33-60,59-76 +6-75,7-75 +3-90,96-99 +38-76,41-76 +18-98,6-19 +2-65,64-77 +3-88,2-88 +14-94,13-93 +40-89,71-99 +44-93,44-72 +48-62,48-61 +6-27,6-26 +43-53,43-54 +4-97,36-98 +8-13,12-83 +15-96,7-96 +18-91,17-18 +11-13,12-55 +31-92,19-94 +44-87,14-45 +18-51,17-18 +23-24,27-27 +23-46,24-88 +12-90,13-90 +37-70,34-70 +1-98,88-98 +2-93,6-95 +73-99,74-98 +4-46,2-46 +50-52,51-75 +45-91,46-90 +11-85,58-94 +26-43,26-44 +56-95,55-94 +10-93,11-92 +1-99,1-99 +8-95,7-7 +19-69,9-18 +18-90,9-60 +74-93,13-73 +62-90,61-72 +7-53,52-95 +44-82,4-44 +17-88,17-88 +26-27,26-89 +1-9,1-62 +13-40,39-62 +2-93,1-92 +91-91,17-91 +57-58,58-85 +23-98,97-99 +16-48,16-48 +25-61,61-87 +14-47,13-84 +46-96,47-94 +8-98,7-99 +3-5,4-97 +38-83,28-82 +7-99,6-34 +23-91,38-84 +33-35,34-63 +14-55,55-55 +34-50,11-35 +3-69,4-69 +67-99,99-99 +38-94,2-59 +2-98,2-97 +77-79,42-78 +6-45,44-45 +39-79,61-93 +5-92,5-97 +4-61,3-64 +47-48,48-67 +11-23,10-23 +2-99,9-99 +31-99,30-81 +28-87,29-88 +8-31,2-13 +3-17,16-83 +29-58,57-59 +4-75,15-35 +49-94,48-93 +23-85,84-84 +7-92,7-97 +53-91,91-97 +26-95,1-95 +9-22,7-9 +13-63,62-95 +54-55,54-97 +80-88,79-88 +1-44,2-44 +3-83,1-4 +95-95,26-95 +23-26,23-26 +19-35,19-34 +17-34,34-34 +39-89,75-97 +42-84,84-84 +60-95,61-94 +6-88,5-88 +2-68,1-68 +16-76,15-16 +30-93,9-96 +10-91,11-91 +36-88,35-36 +24-67,45-66 +41-58,16-96 +84-85,83-85 +10-59,18-59 +33-70,69-69 +58-69,57-58 +4-6,68-85 +3-91,91-91 +99-99,2-98 +33-94,93-95 +68-69,27-68 +4-4,5-14 +98-98,2-97 +5-91,90-92 +2-91,2-90 +37-81,80-80 +9-51,54-69 +45-59,46-59 +8-69,7-69 +20-21,21-29 +45-83,88-91 +22-87,20-21 +4-77,3-76 +50-81,49-49 +47-59,58-78 +22-85,21-84 +3-86,7-91 +63-83,62-63 +10-58,7-57 +14-88,14-88 +18-67,16-28 +39-50,39-42 +9-85,8-85 +7-28,7-8 +72-72,19-73 +25-27,25-56 +40-43,40-43 +10-26,25-25 +29-99,30-99 +9-14,13-92 +9-17,10-56 +93-94,1-94 +31-67,30-68 +15-84,84-84 +45-46,8-46 +10-93,10-94 +31-48,5-94 +49-93,92-92 +45-80,40-67 +63-94,7-93 +2-94,1-66 +26-44,41-53 +51-94,1-94 +5-93,4-92 +14-86,85-86 +9-52,8-10 +24-61,23-62 +1-78,77-79 +6-97,17-96 +43-65,19-43 +45-99,35-99 +58-58,20-57 +22-89,64-85 +12-22,21-80 +6-36,36-36 +1-92,87-92 +26-99,26-97 +7-85,1-85 +20-98,20-98 +2-51,2-54 +73-95,74-95 +16-54,15-17 +4-95,4-96 +11-98,11-98 +67-79,66-80 +61-61,62-63 +50-62,12-50 +9-80,9-81 +1-1,3-87 +16-61,15-23 +31-35,34-40 +13-89,12-90 +89-91,90-95 +20-60,12-81 +2-65,1-66 +38-96,56-96 +23-23,12-22 +96-96,11-95 +8-37,36-97 +2-26,1-26 +30-71,37-73 +71-87,70-70 +31-99,31-82 +6-39,2-7 +1-99,3-99 +29-73,32-81 +33-37,33-36 +15-41,14-40 +32-33,33-90 +23-85,22-24 +26-93,26-86 +3-97,2-98 +10-92,92-94 +29-55,30-55 +9-75,29-96 +6-94,93-97 +63-63,52-63 +24-78,5-5 +38-67,37-67 +14-32,13-32 +35-94,36-94 +23-92,24-92 +9-36,8-36 +63-95,62-62 +37-78,3-78 +34-51,17-37 +84-85,13-84 +1-95,1-98 +18-56,18-19 +17-78,13-16 +6-52,15-44 +13-33,14-33 +10-88,11-89 +61-80,61-79 +6-98,98-98 +1-91,1-85 +60-86,10-87 +3-96,95-98 +34-99,33-98 +19-21,20-91 +7-96,8-96 +2-90,2-90 +36-96,36-96 +76-96,60-75 +8-44,7-44 +9-28,10-28 +10-95,7-95 +56-68,29-82 +10-97,18-99 +68-97,45-97 +19-92,2-92 +6-97,5-97 +74-74,73-73 +20-70,20-70 +18-66,19-67 +91-94,7-92 +4-47,4-47 +11-93,12-93 +33-54,32-53 +54-64,55-63 +20-99,20-21 +39-82,56-68 +4-36,36-47 +30-41,25-31 +65-69,69-69 +20-71,71-74 +16-36,24-54 +2-96,95-98 +11-70,10-12 +5-36,35-95 +36-92,36-37 +37-78,32-87 +28-89,15-88 +9-63,62-62 +2-94,4-94 +85-85,72-85 +30-73,7-31 +10-36,10-36 +75-97,47-95 +23-23,4-24 +49-88,36-87 +25-25,26-42 +33-86,26-86 +13-76,76-76 +60-60,60-60 +3-23,24-24 +4-85,10-85 +7-38,8-37 +40-85,41-84 +46-86,47-87 +8-38,7-38 +76-78,9-77 +80-94,57-94 +86-96,86-97 +35-89,10-67 +45-94,35-81 +8-93,7-8 +22-48,23-47 +21-94,20-94 +63-72,60-73 +89-89,57-90 +34-41,41-78 +5-5,2-6 +1-79,1-80 +79-82,80-83 +37-37,38-53 +65-93,64-96 +33-85,33-33 +7-98,44-57 +2-5,4-69 +19-69,18-68 +80-81,7-81 +19-99,20-99 +5-34,4-14 +4-88,88-89 +51-91,59-93 +33-60,33-58 +32-67,27-94 +8-98,7-8 +34-43,44-69 +10-80,10-11 +7-73,11-73 +23-69,24-69 +68-83,6-68 +2-35,5-35 +1-4,3-90 +88-89,30-89 +57-99,14-63 +16-29,17-28 +67-82,62-77 +20-65,19-66 +37-69,61-63 +58-94,94-94 +1-72,72-72 +7-11,10-47 +18-59,59-59 +57-57,37-58 +60-81,54-72 +2-86,1-87 +7-78,7-77 +59-69,59-65 +15-16,15-73 +15-82,16-92 +8-88,57-88 +36-92,36-88 +59-60,24-59 +4-22,1-3 +44-60,45-60 +90-95,35-89 +21-30,20-30 +4-83,83-83 +16-99,7-17 +11-18,19-95 +45-94,44-94 +3-11,3-12 +9-70,8-10 +1-8,8-78 +1-5,4-97 +30-55,29-31 +7-89,8-89 +47-47,46-48 +66-96,38-84 +33-34,33-73 +2-23,1-22 +52-64,53-91 +9-34,19-61 +25-57,25-57 +1-98,97-98 +79-89,76-80 +28-80,28-80 +13-77,76-78 +3-88,2-88 +69-72,70-72 +91-91,22-91 +77-95,76-94 +84-92,84-91 +55-99,56-99 +1-91,2-91 +33-36,27-36 +79-84,62-74 +52-54,18-53 +26-37,25-27 +55-85,40-85 +58-74,10-59 +6-53,6-53 +42-49,42-47 +47-79,80-97 +11-24,25-91 +83-87,86-87 +1-88,1-96 +55-63,54-62 +76-76,8-76 +3-78,78-99 +1-86,8-96 +44-70,43-70 +25-27,26-91 +65-98,97-97 +14-64,15-65 +9-36,8-35 +78-84,77-85 +42-58,41-59 +60-92,59-60 +95-97,14-86 +8-82,7-83 +5-58,5-59 +5-99,6-99 +4-13,1-4 +57-86,43-58 +11-82,11-11 +4-87,1-5 +6-7,7-11 +6-22,2-7 +15-49,14-49 +39-97,99-99 +12-49,13-90 +70-80,71-80 +46-95,66-94 +94-98,13-94 +3-11,11-11 +13-23,12-23 +11-98,11-98 +20-99,8-20 +28-87,27-87 +16-21,21-61 +2-91,7-56 +7-7,8-71 +74-74,67-74 +23-88,1-74 +1-99,2-98 +34-85,40-86 +6-85,6-68 +28-31,31-49 +13-40,13-40 +55-56,56-56 +70-72,26-71 +93-94,34-93 +45-75,44-75 +4-10,10-50 +65-74,65-77 +39-87,6-59 +11-85,3-85 +8-46,12-46 +9-9,10-95 +30-41,27-92 +13-97,9-96 +21-62,22-63 +54-69,52-53 +17-99,18-99 +75-92,7-76 +38-39,38-90 +50-69,49-50 +65-87,65-99 +6-98,6-96 +34-62,40-90 +33-47,34-48 +33-95,34-95 +42-99,43-98 +70-85,1-71 +37-63,38-63 +12-17,17-72 +28-31,29-92 +18-69,8-17 +41-96,40-95 +7-86,7-86 +68-78,67-73 +4-6,7-99 +8-86,86-87 +5-6,6-37 +88-94,89-95 +33-74,33-74 +86-87,86-87 +29-55,62-78 +23-38,13-38 +9-44,10-89 +18-67,19-97 +3-83,1-66 +55-81,55-81 +6-72,7-71 +5-55,6-55 +14-99,14-97 +39-83,16-40 +11-73,55-73 +4-68,5-67 +66-73,26-73 +3-92,3-91 +36-59,33-35 +72-73,4-73 +1-83,2-83 +25-88,25-43 +45-71,45-73 +9-96,95-95 +4-5,7-23 +48-50,4-49 +45-96,44-96 +50-87,49-50 +98-99,27-96 +4-40,40-78 +3-94,94-94 +7-34,25-26 +72-79,23-72 +2-84,3-83 +78-96,25-78 +77-94,73-94 +63-66,62-65 +25-80,24-80 +10-33,78-90 +25-55,24-54 +58-62,23-64 +61-62,62-84 +83-83,46-84 +23-30,31-92 +8-95,94-99 +35-65,34-64 +12-19,12-18 +21-25,24-43 +54-79,54-84 +37-56,37-57 +77-77,15-77 +57-88,55-88 +7-93,8-93 +5-89,3-66 +33-63,32-33 +9-52,51-96 +7-97,6-66 +3-58,1-3 +26-85,25-84 +11-63,10-12 +52-54,53-54 +23-68,22-22 +14-96,14-95 +4-41,3-21 +4-6,5-83 +97-98,1-97 +13-90,73-88 +11-15,7-10 +65-80,24-81 +48-82,48-83 +81-87,4-81 +40-47,40-47 +15-87,14-75 +30-50,29-30 +26-65,64-64 +37-37,7-37 +51-51,49-51 +5-71,7-70 +18-54,53-54 +47-48,48-60 +26-98,25-97 +5-6,5-81 +3-98,3-99 +9-22,21-22 +4-97,1-1 +36-36,37-77 +22-35,4-23 +18-95,19-96 +14-94,14-96 +43-46,47-50 +80-91,81-91 +20-67,5-81 +8-87,9-86 +30-69,23-30 +96-99,2-96 +59-75,74-76 +20-66,19-66 +10-85,10-65 +9-82,8-38 +32-66,54-66 +23-64,63-65 +1-89,1-90 +1-95,1-94 +12-82,7-64 +55-66,60-66 +3-93,3-42 +45-87,15-88 +3-50,3-76 +7-86,8-79 +39-39,40-85 +57-86,52-52 +17-84,16-18 +63-99,64-99 +83-94,83-94 +12-85,11-86 +18-89,17-17 +12-25,13-87 +9-12,10-15 +62-92,85-88 +26-97,26-94 +16-94,94-94 +47-83,47-83 +25-86,85-88 +1-99,1-98 +47-87,87-99 +9-99,9-97 +8-73,2-73 +45-47,46-85 +18-95,18-96 +41-41,40-41 +1-4,4-61 +4-95,5-96 +8-79,78-80 +6-81,9-81 +7-90,1-7 +6-22,6-22 +32-82,15-59 +19-93,13-93 +43-48,12-99 +45-45,46-59 +27-69,1-28 +78-78,59-79 +12-57,57-57 +4-39,4-77 +55-91,91-91 +27-87,92-95 +83-87,87-98 +22-84,22-31 +3-91,3-22 +45-86,57-62 +68-82,55-82 +96-98,3-97 +12-32,1-32 +37-71,37-71 +31-59,31-59 +86-88,79-88 +4-92,3-3 +40-91,17-91 +51-52,52-74 +2-97,1-98 +50-83,82-83 +34-34,35-41 +6-47,5-5 +5-65,5-47 +32-77,33-85 +21-68,22-67 +12-45,46-95 +45-48,38-46 +39-84,35-40 +4-60,3-4 +67-83,68-84 +24-92,25-93 diff --git a/main.cpp b/main.cpp index 8ab7e53..520d31c 100644 --- a/main.cpp +++ b/main.cpp @@ -4,86 +4,42 @@ using namespace olc; -class Example : public olc::PixelGameEngine +int main() { -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}; - - 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); - - if (t_hit_far < 0) return false; - - contact_point.x = ray_origin.x + t_hit_near * ray_dir.x; - contact_point.y = ray_origin.y + t_hit_near * ray_dir.y; - - 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 }; + std::ifstream file("input"); + int sum=0; + while (file.good()) { + std::string line; + std::getline(file,line); + int marker=0; + int prevmarker=0; + prevmarker=marker;marker=line.find_first_of('-'); + int digit1=std::atoi(line.substr(0,marker).c_str()); + prevmarker=marker;marker=line.find_first_of(',',marker); + int digit2=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str()); + prevmarker=marker;marker=line.find_first_of('-',marker); + int digit3=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str()); + prevmarker=marker;marker=line.find_first_of('\n',marker); + int digit4=std::atoi(line.substr(prevmarker+1,marker-prevmarker).c_str()); + + //1-3 3-5 // 3-5 1-3 + //1-4 4-7 + //1-3 4-9 + //4-6 5-9 + //6-9 1-7 // 1-7 6-9 - return true; - - - } - vf2d originPoint={16,16}; - bool OnUserCreate() override - { - // Called once at the start, so create things here - return true; - } - - bool OnUserUpdate(float fElapsedTime) override - { - vf2d velocity={(GetKey(D).bHeld-GetKey(A).bHeld)*20*fElapsedTime,(GetKey(S).bHeld-GetKey(W).bHeld)*20*fElapsedTime}; - vf2d contact_point; - vf2d contact_normal; - float t_hit_near; - - Clear(Pixel(64,64,255)); - if (!olc::utils::geom2d::overlaps(olc::utils::geom2d::circle{originPoint+velocity,5},olc::utils::geom2d::rect{{32,32},{64,32}})) { - originPoint+=velocity; - DrawCircle(originPoint,5); + if (digit1<=digit4&&digit2>=digit3||digit2>=digit3&&digit1<=digit4) { + sum++; + std::cout<{{32,32},{64,32}},contact_point,contact_normal,t_hit_near)&&t_hit_near<1?YELLOW:WHITE); - return true; - } -}; - - -int main() -{ - Example demo; - if (demo.Construct(128, 120, 8, 8)) - demo.Start(); + } + std::cout<<"Sum: "<