diff --git a/README.md b/README.md index 99cf7d5..57a502a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Program written in C++ that allows testing of ML techinques to learn how to play ![Graph](resources/imgs/evolution.png) +![Graph](resources/imgs/meanevolution.png) + Generation #1: 4.59992, 71.8593(mean=15.4673) 200 individuals Generation #2: 6.14182, 73.3668(mean=16.7839) 200 individuals Generation #3: 6.28141, 75.3769(mean=16.7136) 200 individuals diff --git a/resources/histories/.gitkeep b/resources/histories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/histories/2014-04-20-17-46-09 b/resources/histories/2014-04-20-17-46-09 deleted file mode 100644 index 69c997d..0000000 --- a/resources/histories/2014-04-20-17-46-09 +++ /dev/null @@ -1,8 +0,0 @@ -0 -75.8794 -6.53266 -15.2085 -1 -73.8693 -6.78392 -15.8643 diff --git a/resources/histories/2014-04-20-19-26-07 b/resources/histories/2014-04-20-19-26-07 new file mode 100644 index 0000000..33a3083 --- /dev/null +++ b/resources/histories/2014-04-20-19-26-07 @@ -0,0 +1,800 @@ +0 +51.7588 +-32.6633 +13.3065 +1 +45.7286 +-21.608 +11.804 +2 +45.7286 +-32.6633 +11.4824 +3 +47.7387 +-21.608 +12.2211 +4 +50.7538 +-31.6583 +13.1156 +5 +46.7337 +-27.6382 +13.1206 +6 +51.2563 +-26.6332 +16.2613 +7 +60.3015 +-24.6231 +17.9497 +8 +56.7839 +-26.6332 +17.9598 +9 +57.7889 +-16.5829 +18.8442 +10 +56.2814 +-19.598 +19.0151 +11 +63.8191 +-26.6332 +20.9196 +12 +62.8141 +-19.598 +21.8141 +13 +55.7789 +-16.5829 +21.7236 +14 +60.804 +-30.6533 +24.7588 +15 +68.8442 +-27.6382 +25.8894 +16 +70.8543 +-25.6281 +26.3869 +17 +66.3317 +-15.5779 +29.4221 +18 +66.8342 +-21.608 +29.2764 +19 +66.8342 +-20.603 +30.2814 +20 +76.8844 +-16.5829 +36.2261 +21 +80.402 +-5.52764 +40.7437 +22 +84.9246 +2.51256 +46.794 +23 +80.9045 +1.50754 +49.0704 +24 +89.9497 +-11.5578 +50.9397 +25 +93.9698 +-35.6784 +49.7789 +26 +94.9749 +-8.54271 +49.2312 +27 +88.9447 +-11.5578 +53.4523 +28 +89.9497 +6.53266 +54.5528 +29 +89.9497 +-10.5528 +58.4372 +30 +85.9296 +6.53266 +57.6683 +31 +87.9397 +-2.51256 +56.206 +32 +94.9749 +0.502513 +60.7035 +33 +90.9548 +13.5678 +62.4121 +34 +91.9598 +2.51256 +62.1005 +35 +92.9648 +12.5628 +64.9095 +36 +93.9698 +14.5729 +60.8794 +37 +92.4623 +24.6231 +61.2362 +38 +92.9648 +8.54271 +62.3869 +39 +95.9799 +10.5528 +62.8794 +40 +96.9849 +10.5528 +66.1658 +41 +97.99 +27.6382 +68.2915 +42 +97.4874 +32.6633 +67.6432 +43 +98.995 +15.5779 +67.0402 +44 +98.995 +-6.53266 +73.8643 +45 +100 +20.603 +71.7588 +46 +100 +6.53266 +74.8895 +47 +100 +-7.53769 +75.3266 +48 +100 +15.5779 +74.0402 +49 +100 +8.54271 +71.9296 +50 +100 +-0.502513 +74.402 +51 +100 +28.6432 +74.7739 +52 +100 +33.6683 +77.2462 +53 +100 +0.502513 +76.2412 +54 +100 +28.6432 +79.3568 +55 +100 +28.6432 +78.2814 +56 +100 +32.6633 +82.1256 +57 +100 +41.7085 +81.0704 +58 +100 +34.6734 +81.6784 +59 +100 +43.7186 +80.5126 +60 +100 +28.6432 +78.0955 +61 +100 +40.7035 +79.603 +62 +100 +39.6985 +82.4221 +63 +100 +45.7286 +84.5377 +64 +100 +46.7337 +81.7236 +65 +100 +38.6935 +87.2211 +66 +100 +43.7186 +84.5578 +67 +100 +56.7839 +87.2312 +68 +100 +17.5879 +85.7236 +69 +100 +35.6784 +86.5377 +70 +100 +40.7035 +86.2915 +71 +100 +34.6734 +85.799 +72 +100 +33.6683 +87.3317 +73 +100 +49.7487 +89.191 +74 +100 +2.51256 +89.5276 +75 +100 +63.8191 +88.7487 +76 +100 +33.6683 +88.799 +77 +100 +27.6382 +89.9799 +78 +100 +30.6533 +89.9296 +79 +100 +63.8191 +90.1809 +80 +100 +21.608 +86.9196 +81 +100 +25.6281 +87.0151 +82 +100 +24.6231 +89.4523 +83 +100 +24.6231 +90.6482 +84 +100 +25.6281 +91.196 +85 +100 +39.6985 +88.9598 +86 +100 +21.608 +89.0251 +87 +100 +65.8291 +88.3719 +88 +100 +59.799 +92.6884 +89 +100 +68.8442 +92.1206 +90 +100 +55.7789 +90.6533 +91 +100 +59.799 +88.8794 +92 +100 +4.52261 +88.9397 +93 +100 +16.5829 +87.9598 +94 +100 +63.8191 +90.6382 +95 +100 +70.8543 +90.2462 +96 +100 +63.8191 +91.6884 +97 +100 +58.794 +90.5628 +98 +100 +87.4372 +92.5075 +99 +100 +28.6432 +89.5829 +100 +100 +16.5829 +89.8643 +101 +100 +15.5779 +89.7789 +102 +100 +18.593 +91.4322 +103 +100 +37.6884 +91.2814 +104 +100 +24.6231 +90.5025 +105 +100 +21.608 +89.9548 +106 +100 +55.7789 +88.2211 +107 +100 +75.8794 +86.8844 +108 +100 +76.8844 +90.3216 +109 +100 +87.9397 +90.0804 +110 +100 +61.809 +90.392 +111 +100 +22.6131 +89.3668 +112 +100 +17.5879 +90.7286 +113 +100 +5.52764 +89.7889 +114 +100 +67.8392 +90.3769 +115 +100 +78.8945 +90.4573 +116 +100 +86.9347 +93.2663 +117 +100 +84.9246 +90.4874 +118 +100 +51.7588 +93.9698 +119 +100 +66.8342 +91.4171 +120 +100 +85.9296 +92.5528 +121 +100 +95.9799 +93.4271 +122 +100 +96.9849 +91.9598 +123 +100 +87.9397 +93.6281 +124 +100 +83.9196 +92.0553 +125 +100 +72.8643 +90.5477 +126 +100 +76.8844 +92.5377 +127 +100 +98.995 +90.4523 +128 +100 +43.7186 +92.1809 +129 +100 +47.7387 +92.196 +130 +100 +45.7286 +89.9246 +131 +100 +56.7839 +88.6935 +132 +100 +49.7487 +91.9648 +133 +100 +58.794 +93.0603 +134 +100 +61.809 +89.7085 +135 +100 +29.6482 +87.392 +136 +100 +67.8392 +89.9397 +137 +100 +33.6683 +92.8995 +138 +100 +11.5578 +88.2211 +139 +100 +70.8543 +92.6784 +140 +100 +82.9146 +89.7889 +141 +100 +85.9296 +93.8643 +142 +100 +7.03518 +90.804 +143 +100 +87.9397 +91.9347 +144 +100 +87.4372 +92.9548 +145 +100 +90.9548 +92.4121 +146 +100 +88.9447 +92.804 +147 +100 +37.6884 +93.4422 +148 +100 +39.6985 +91.4824 +149 +100 +35.6784 +88.7487 +150 +100 +-6.53266 +90.7035 +151 +100 +-11.5578 +90.6231 +152 +100 +-3.51759 +89.3769 +153 +100 +-4.52261 +90.3116 +154 +100 +6.53266 +90.2513 +155 +100 +6.53266 +89.397 +156 +100 +53.7688 +90.8844 +157 +100 +18.593 +92.0251 +158 +100 +9.54774 +92.4271 +159 +100 +7.53769 +90.8744 +160 +100 +38.6935 +93.0754 +161 +100 +54.7739 +89.4573 +162 +100 +14.5729 +92.2814 +163 +100 +8.54271 +90.3819 +164 +100 +58.794 +89.1508 +165 +100 +67.8392 +89.3518 +166 +100 +59.799 +89.7688 +167 +100 +72.8643 +92.5628 +168 +100 +62.8141 +90.6683 +169 +100 +67.8392 +92.2864 +170 +100 +65.8291 +90.0603 +171 +100 +62.8141 +90.6533 +172 +100 +96.9849 +91.3216 +173 +100 +98.4925 +92.3417 +174 +100 +91.9598 +89.9397 +175 +100 +91.9598 +93.5628 +176 +100 +91.9598 +91.5276 +177 +100 +29.1457 +93.0955 +178 +100 +16.5829 +89.2211 +179 +100 +-3.51759 +86.8492 +180 +100 +-9.54774 +90.3015 +181 +100 +-0.502513 +88.1407 +182 +100 +40.7035 +91.7638 +183 +100 +37.6884 +89.2613 +184 +100 +53.7688 +92.5528 +185 +100 +50.7538 +90.9698 +186 +100 +6.53266 +87.9548 +187 +100 +33.6683 +87.7035 +188 +100 +38.6935 +88.4975 +189 +100 +27.6382 +89.201 +190 +100 +14.5729 +88.0955 +191 +100 +23.6181 +90.4874 +192 +100 +47.7387 +88.1357 +193 +100 +50.7538 +89.191 +194 +100 +32.6633 +89.9497 +195 +100 +40.7035 +88 +196 +100 +19.598 +86.794 +197 +100 +22.6131 +84.3116 +198 +100 +-5.52764 +82.5879 +199 +100 +43.7186 +86.2513 diff --git a/resources/imgs/meanevolution.png b/resources/imgs/meanevolution.png new file mode 100644 index 0000000..3b7b309 Binary files /dev/null and b/resources/imgs/meanevolution.png differ diff --git a/resources/individuals/.gitkeep b/resources/individuals/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/individuals/2014-04-20-18-27-07 b/resources/individuals/2014-04-20-18-27-07 new file mode 100644 index 0000000..866904b --- /dev/null +++ b/resources/individuals/2014-04-20-18-27-07 @@ -0,0 +1,1244 @@ +0000000000 +10000100005 +1000010000 +22000100001 +1010000000 +20100002007 +1100000000 +21200000002 +2010000020 +30101020004 +2010000200 +30121000004 +2010020000 +31100200001 +2010200000 +31000010209 +2020010000 +30100100208 +2100000002 +31000100025 +2100002000 +31010000207 +2100020000 +31010200003 +2102000000 +31120000002 +2120000000 +31002010008 +2200010000 +32100100002 +2210000000 +32011000007 +3001100200 +41000012029 +3010010020 +40102100204 +3010010200 +40100102029 +3010020010 +42100200101 +3010100002 +42101000021 +3010102000 +40121020003 +3010120000 +42101200001 +3010210000 +42102100001 +3012100000 +40121000208 +3020101000 +42201010003 +3100001020 +40011002209 +3100001200 +41000212005 +3100010002 +41020100023 +3100012000 +41000120208 +3100020001 +41200200012 +3100021000 +40011202009 +3100201000 +41002010208 +3101000020 +41012000206 +3101000200 +41210002002 +3101020000 +41010200208 +3101200000 +41212000002 +3102010000 +41022100004 +3110000002 +41102000024 +3110000020 +41100002207 +3110000200 +41100022006 +3110002000 +41100020029 +3110020000 +41100200029 +3110200000 +41102020006 +3112000000 +41120000208 +3120000001 +42210001003 +3120001000 +41202010004 +3120010000 +41022100007 +3121000000 +41210000208 +3201000100 +42210001004 +3201100000 +42211000002 +3210000010 +42100000129 +3210010000 +42100100208 +3210100000 +42121000003 +4001100220 +51012002109 +4001120200 +51010202109 +4010010202 +50121100024 +4010010220 +50121120004 +4010102002 +51100012207 +4010102020 +50101120205 +4010120002 +51101200021 +4010122000 +51102210003 +4010202010 +50102120105 +4010210002 +51102100021 +4010210020 +51102100201 +4010210200 +51102102001 +4010212000 +50102120108 +4012100002 +51121000021 +4012100020 +50121100205 +4012100200 +50121102005 +4012102000 +50101012208 +4012120000 +52100211009 +4020121000 +51100220109 +4021100200 +52101020018 +4021200100 +51212001001 +4100001202 +51000112025 +4100001220 +51000112205 +4100012002 +50011102208 +4100012020 +51100120202 +4100021020 +51012200107 +4100021200 +51100212002 +4100201002 +51102010022 +4100201020 +51002110205 +4100201200 +51002112005 +4100221000 +51102210002 +4101000202 +51010002128 +4101000220 +51011002204 +4101020020 +51110200202 +4101020200 +51110202002 +4101200002 +51012100025 +4101200020 +51012100205 +4101200200 +51012002108 +4101202000 +51012020108 +4101220000 +51011220006 +4102000201 +51020102015 +4102001200 +51120002104 +4102010002 +51100102024 +4102010020 +51100122004 +4102010200 +51120102002 +4102012000 +51100102204 +4102200001 +51122000012 +4102201000 +51022010108 +4102210000 +51200112008 +4110000022 +50111002206 +4110000202 +51100102025 +4110000220 +51100012206 +4110002002 +51100120025 +4110002020 +51112000203 +4110002200 +51112000023 +4110020002 +51110202003 +4110020020 +51110200203 +4110020200 +51021210008 +4110022000 +51011200207 +4110200002 +51211000027 +4110200020 +51112000203 +4110200200 +51102102005 +4110202000 +51211000207 +4110220000 +51112200003 +4112000002 +51120000128 +4112000020 +51121000204 +4112000200 +51121002004 +4112002000 +51011002207 +4112020000 +51120200108 +4112200000 +51122100005 +4120000021 +51102020014 +4120001020 +51102020104 +4120001200 +51122000104 +4120010002 +51012100027 +4120010020 +51200100219 +4120012000 +51212100003 +4120020001 +50112201006 +4120021000 +51200210108 +4120200001 +51210021003 +4120201000 +51211020003 +4120210000 +51212100003 +4121000020 +51210100205 +4121000200 +51211002004 +4121020000 +51211200004 +4121200000 +51210021009 +4122010000 +52211100006 +4201020100 +51010201029 +4201100020 +52011100205 +4201100200 +52011102005 +4201120000 +52110201007 +4202101000 +50101012028 +4210000012 +52101010024 +4210002010 +51201010029 +4210010002 +51020112007 +4210010020 +51002110029 +4210010200 +50121100026 +4210012000 +52101120004 +4210020010 +51021210007 +4210100002 +52101010026 +4210102000 +52111000207 +4210120000 +52101200019 +4210210000 +52201110008 +4212000010 +51021010027 +4212010000 +52121100004 +4212100000 +52121010006 +4220101000 +51221010003 +4221000100 +51010021029 +4221100000 +51012002109 +5001110220 +62011102201 +5010101202 +60101212025 +5010101220 +60101212205 +5010112002 +62101120021 +5010112020 +60121120207 +5010121020 +62101210201 +5010121200 +62101212001 +5011100220 +60111202205 +5011120200 +61102210026 +5011200120 +62112001201 +5011220100 +61100222019 +5012110002 +62121100021 +5012110020 +60121120206 +5012110200 +60121122008 +5012112000 +60121120208 +5021110200 +62211102001 +5100011202 +61000112228 +5100011220 +61020112203 +5100211002 +62011122003 +5100211020 +61002110229 +5100211200 +61202112002 +5101000212 +61210002122 +5101002102 +61210021022 +5101002120 +61010221205 +5101010202 +61010102228 +5101010220 +61210102202 +5101020102 +61210201022 +5101020210 +61012200126 +5101022100 +61210201204 +5101100022 +61011002227 +5101100202 +61011022026 +5101100220 +61011202205 +5101102002 +61211020022 +5101102020 +61211020202 +5101102200 +61011022208 +5101120002 +61211200022 +5101120020 +61011202207 +5101120200 +61011202029 +5101122000 +61011222007 +5101200012 +61212000122 +5101200210 +61212002102 +5101202010 +61012220105 +5101210002 +61012122006 +5101210020 +61212100202 +5101210200 +61012122006 +5101212000 +61012120208 +5101220010 +61012200129 +5102001210 +62121002019 +5102011200 +61220112002 +5102101002 +61021010228 +5102101020 +61221010202 +5102121000 +61221210002 +5102201010 +61220012107 +5102211000 +62011122009 +5110000221 +61100022216 +5110001202 +61100012228 +5110001220 +61102012204 +5110002012 +61120020123 +5110002201 +62112001023 +5110010022 +61120100223 +5110010202 +61120102023 +5110010220 +61120102203 +5110012002 +61100122027 +5110012020 +61102120204 +5110012200 +61102122004 +5110020012 +61100220126 +5110020021 +62110201203 +5110020201 +61100202218 +5110021020 +61100212207 +5110021200 +61100212029 +5110022010 +61102220104 +5110102002 +61101020228 +5110102020 +61101020229 +5110120002 +61121200023 +5110122000 +61101220208 +5110200021 +61102020216 +5110200201 +61102022016 +5110201002 +61102010228 +5110201020 +61122010203 +5110201200 +61102212005 +5110202001 +62112021003 +5110202010 +61102220105 +5110210002 +61102102027 +5110210020 +61102100229 +5110210200 +61122102003 +5110212000 +61102122007 +5110220001 +61102220016 +5110221000 +61122210003 +5112000012 +61122000124 +5112000201 +62112001026 +5112000210 +61120002129 +5112001200 +61120012208 +5112002010 +61120022107 +5112010002 +61120100228 +5112010020 +61120100229 +5112010200 +61122102004 +5112012000 +61122120004 +5112020010 +61122200104 +5112100002 +61121002027 +5112100020 +61121200205 +5112100200 +61121022006 +5112102000 +61121022007 +5112120000 +61121200029 +5112200001 +61122002017 +5112200010 +61122020106 +5112201000 +62111022009 +5112210000 +61122102007 +5120011020 +62211100203 +5120011200 +61200112029 +5120021010 +61022210107 +5120101002 +61221010023 +5120121000 +61122200107 +5120201010 +61202210105 +5120211000 +61202110208 +5121000102 +61210021026 +5121000120 +61210021206 +5121000210 +61210002129 +5121002100 +61210021029 +5121010020 +61212100204 +5121010200 +61210102029 +5121020010 +61210202107 +5121020100 +61210201208 +5121100002 +61211000228 +5121100020 +61211020206 +5121100200 +61211202005 +5121102000 +61211220005 +5121120000 +61211200208 +5121200010 +61212000129 +5121200100 +61212201005 +5121210000 +61212100029 +5122101000 +61221210005 +5201110020 +61020112209 +5201110200 +62011102208 +5210021100 +62211200104 +5210101002 +62101012027 +5210101020 +62101010229 +5210101200 +62121012003 +5210102001 +62121000217 +5210110002 +62121100023 +5210112000 +62101120208 +5210120001 +62101220018 +5210121000 +62101210208 +5211000120 +61120002219 +5211020100 +61120202019 +5211100020 +61120012209 +5211100200 +62111202005 +5211120000 +61122210006 +5211200100 +62112001029 +5212100001 +62122011006 +5212101000 +62121210005 +5212110000 +62121100029 +5221100010 +61222010106 +5221110000 +61220112009 +6010112022 +71101120221 +6010121202 +72121210108 +6010121220 +71102212109 +6011120220 +71111202201 +6011220120 +71112201201 +6012110022 +71102112027 +6012110202 +71121102021 +6012112020 +71102110227 +6012112200 +72101110228 +6021110220 +71012122109 +6100211022 +71102110222 +6100211202 +71102112022 +6100211220 +71011120223 +6101002122 +71010121225 +6101020212 +71120211026 +6101022102 +71011202218 +6101022120 +71110221202 +6101102022 +71110021227 +6101102202 +71120011228 +6101102220 +71011122205 +6101120022 +71111200222 +6101120202 +71111202022 +6101120220 +71111202202 +6101122002 +71111220022 +6101122020 +71012211209 +6101122200 +71011222019 +6101200212 +71112002122 +6101202210 +71211002219 +6101210022 +71112100222 +6101210202 +71112102022 +6101210220 +71112102202 +6101212020 +71112120202 +6101212200 +71012122108 +6101220012 +71211202017 +6101220210 +71011220126 +6102011220 +71122102019 +6102101022 +71112002127 +6102121002 +71121210022 +6102121020 +71121210202 +6102211020 +71122110202 +6102211200 +71120102219 +6102221010 +71121200219 +6110002221 +71100122215 +6110012022 +71101120224 +6110012202 +71021110228 +6110012220 +71121120204 +6110020221 +71121220014 +6110021202 +71101212024 +6110021220 +70111221029 +6110022012 +71112202103 +6110022201 +71112201023 +6110102022 +71111020223 +6110122002 +71111200227 +6110122020 +71101220219 +6110200221 +71102102215 +6110201022 +71211020127 +6110201202 +71102112025 +6110201220 +70111021229 +6110202012 +71112022103 +6110202021 +71212011207 +6110202201 +72112021108 +6110210022 +71112100223 +6110210202 +71221110028 +6110210220 +71112102203 +6110212002 +71102120128 +6110212020 +71112120203 +6110212200 +71102122019 +6110220021 +71212211007 +6110220201 +71110221023 +6110221002 +71211200127 +6110221020 +71111220203 +6110221200 +71111220023 +6112000212 +71121012024 +6112000221 +71120102215 +6112001220 +72111021029 +6112002210 +71221012019 +6112010022 +71011122027 +6112010202 +72111102026 +6112010220 +71120102219 +6112012020 +72112101209 +6112012200 +72112101029 +6112020012 +71011212027 +6112022010 +71011212207 +6112100022 +71111022027 +6112100202 +71121012026 +6112102020 +71121020219 +6112102200 +71121022019 +6112120002 +71111202027 +6112120020 +71121200219 +6112122000 +71121220019 +6112200012 +71122100125 +6112200021 +71211022017 +6112200201 +71221012018 +6112201020 +71122110205 +6112201200 +72111021029 +6112202010 +72112021109 +6112210002 +72111122006 +6112210020 +71122110206 +6112210200 +71122102019 +6112212000 +71211102207 +6112220001 +71211202017 +6112220010 +71122210106 +6112221000 +72111221009 +6120011202 +71122100124 +6120011220 +71122120104 +6120121002 +71211212003 +6120201012 +71202110125 +6120211002 +71211122003 +6120211020 +71102120219 +6120211200 +71222110108 +6120221010 +71101220219 +6121000122 +71211002216 +6121000212 +71122011024 +6121002102 +71112001224 +6121002120 +71112021204 +6121010202 +71210102128 +6121010220 +71210101229 +6121020102 +71011222018 +6121020210 +71011222019 +6121022100 +71212201019 +6121100022 +71211100225 +6121100202 +71211102025 +6121100220 +71211102205 +6121102002 +71211120025 +6121102020 +71112021207 +6121102200 +71122011208 +6121120002 +71211212006 +6121120200 +71122211008 +6121122000 +71212211009 +6121200012 +71212100125 +6121200102 +71212101025 +6121200210 +71011022219 +6121202010 +71212120105 +6121202100 +71212011208 +6121210002 +71212100128 +6121210020 +71210121209 +6121210200 +71210121029 +6121212000 +71212121007 +6121220010 +71012211209 +6121220100 +71212201019 +6122001210 +71122012104 +6122011200 +71220112108 +6122101002 +71112002127 +6122101020 +72112021109 +6122101200 +71221012019 +6122121000 +71112202107 +6122201010 +71121020219 +6122211000 +71222110108 +6201110202 +71120102126 +6201110220 +72111102202 +6201112200 +72111122002 +6210101022 +71122012107 +6210101202 +72121012108 +6210101220 +72101112205 +6210112002 +71120112207 +6210112020 +71202110129 +6210121020 +71102210129 +6210121200 +71100212129 +6210122001 +71122211003 +6211020120 +71011222019 +6211100202 +72111002128 +6211100220 +71121010226 +6211102200 +72111022108 +6211120020 +71121210206 +6211120200 +71120211029 +6211200102 +72112101025 +6211200120 +71121020216 +6211202100 +72112021108 +6211220100 +71011202219 +6212100021 +72121100215 +6212100201 +72111002128 +6212101020 +72111022107 +6212101200 +72121112005 +6212110002 +72101112028 +6212110020 +72121110206 +6212110200 +72121102019 +6212112000 +72101112208 +6212120001 +72111202106 +6212121000 +72111202107 +6212201100 +71120011229 +6221110020 +71221110206 +6221110200 +71012102129 +6221120010 +71121220017 +7011102122 +80111221225 +7011122102 +82111221021 +7011122120 +82111221201 +7101102221 +81011222215 +7101112022 +81211120222 +7101112202 +81011122228 +7101112220 +81011122229 +7101120221 +81211202212 +7101121202 +81011212228 +7101121220 +81211212202 +7101122012 +81120211227 +7101122201 +81211222012 +7101210212 +81012122126 +7101212210 +81212122102 +7101221120 +81011222219 +7110021212 +82111202123 +7110112022 +81121120223 +7110121022 +81101212227 +7110121202 +81121212023 +7110121220 +81101212229 +7110122021 +81121220217 +7110201212 +81122012123 +7110211022 +82111122203 +7110211202 +81102112228 +7110211220 +81122112203 +7110221012 +82111222103 +7110221210 +81102212129 +7112001122 +81122011224 +7112011220 +81122112204 +7112021102 +81122211024 +7112021120 +81122211204 +7112101022 +81121210225 +7112101202 +81121012228 +7112101220 +81121012229 +7112102021 +81121220215 +7112102201 +81121022218 +7112110022 +81121122027 +7112110202 +81121122026 +7112112020 +81121122207 +7112112200 +81121122029 +7112120021 +81121222017 +7112121002 +81121210228 +7112121020 +81121210229 +7112122001 +81121220218 +7112201102 +81122211025 +7112201120 +81122211205 +7112201210 +81122212105 +7112211020 +82111122209 +7112211200 +81122112208 +7112220011 +82112221106 +7112221010 +82111222109 +7112221100 +81122211208 +7120211012 +82122111203 +7121010212 +81212102124 +7121100221 +81211022216 +7121101202 +81211012228 +7121101220 +81211012229 +7121102012 +81211220125 +7121102201 +81211022218 +7121110022 +81211120226 +7121110202 +81211122026 +7121110220 +81211102229 +7121112002 +81211120228 +7121112020 +81211120229 +7121112200 +81211122029 +7121120012 +81211220126 +7121120201 +81211202218 +7121121200 +81211212208 +7121122010 +81211220129 +7121201120 +81212211205 +7121202101 +81212021218 +7121210012 +81212122106 +7121210210 +81212102129 +7121212010 +81212122107 +7121220101 +81212221016 +7121221100 +81211222019 +7122011210 +82121122019 +7122101201 +81221212015 +7122211010 +82122111209 +7211100212 +82111202125 +7211102102 +82111221025 +7211102120 +82111021229 +7211102210 +82111222105 +7211110202 +82111102228 +7211110220 +82111122206 +7211112200 +82111122208 +7211120210 +82111202129 +7211122100 +82111221029 +7211202110 +81122022119 +7212101210 +82121012129 +7212110021 +82122111206 +7212110201 +82121122018 +7212121010 +82121212107 +7212211100 +82121122019 +7221121100 +82112221108 +8011122122 +91111221221 +8101122221 +91111222212 +8101212212 +91112122122 +8110221212 +91111222123 +8112021122 +91111222124 +8112102221 +91121122215 +8112112220 +91121122219 +8112121022 +91111222127 +8112122021 +91111222217 +8112201212 +91122112125 +8112202211 +91122122115 +8112211202 +91122112128 +8112211220 +92111121229 +8121102221 +91211122215 +8121112022 +91112121227 +8121112202 +91122111228 +8121112220 +91211122219 +8121121202 +91211212128 +8121122012 +91111222217 +8121122201 +91122211218 +8121202121 +91212121215 +8121212210 +91211122219 +8122211210 +91121122219 +8211102122 +92111121225 +8211112220 +91122111229 +8211122120 +91122211219 +8211122210 +91211212129 +8212101212 +92121112125 +8212112201 +91122112128 diff --git a/resources/individuals/2014-04-20-19-26-07 b/resources/individuals/2014-04-20-19-26-07 new file mode 100644 index 0000000..d72298d --- /dev/null +++ b/resources/individuals/2014-04-20-19-26-07 @@ -0,0 +1,1244 @@ +0000000000 +10100000002 +1000010000 +20200100002 +1010000000 +20100000208 +1100000000 +21000000029 +2010000020 +30101020004 +2010000200 +32100000108 +2010020000 +30100200108 +2010200000 +30101020006 +2020010000 +31000120007 +2100000002 +31000100025 +2100002000 +31200000019 +2100020000 +31000210006 +2102000000 +31000012008 +2120000000 +31002010008 +2200010000 +31020100003 +2210000000 +31120000003 +3001100200 +42011002001 +3010010020 +40100102207 +3010010200 +42100100023 +3010020010 +40201210004 +3010100002 +40101200025 +3010102000 +42101020001 +3010120000 +42101200001 +3010210000 +40102102007 +3012100000 +40121020006 +3020101000 +42100020109 +3100001020 +42011000203 +3100001200 +41000212005 +3100010002 +41200100022 +3100012000 +41020120003 +3100020001 +41200200012 +3100021000 +41000210208 +3100201000 +41202010002 +3101000020 +41010200205 +3101000200 +41010202005 +3101020000 +41210200002 +3101200000 +41012200005 +3102010000 +41020100029 +3110000002 +41100000228 +3110000020 +41102000204 +3110000200 +41100002208 +3110002000 +41120020003 +3110020000 +41100200208 +3110200000 +41102000208 +3112000000 +41120000029 +3120000001 +41022000017 +3120001000 +42211000003 +3120010000 +41200100208 +3121000000 +41212000004 +3201000100 +42010201005 +3201100000 +42011200005 +3210000010 +42021010007 +3210010000 +42102100004 +3210100000 +42101020006 +4001100220 +50011102205 +4001120200 +51100200126 +4010010202 +50121100024 +4010010220 +51100100223 +4010102002 +51102012003 +4010102020 +50101120205 +4010120002 +51100212003 +4010122000 +50101210208 +4010202010 +50102120105 +4010210002 +50121100206 +4010210020 +51202110007 +4010210200 +51102102001 +4010212000 +51102120001 +4012100002 +50121100025 +4012100020 +51022010109 +4012100200 +51020012109 +4012102000 +50101012208 +4012120000 +50111202007 +4020121000 +50101210208 +4021100200 +51012000129 +4021200100 +50212101005 +4100001202 +52121000018 +4100001220 +51102002019 +4100012002 +50011102208 +4100012020 +51012100203 +4100021020 +51012200107 +4100021200 +51120200104 +4100201002 +51011022003 +4100201020 +51102010202 +4100201200 +52211000108 +4100221000 +51200210108 +4101000202 +51010102025 +4101000220 +51011000226 +4101020020 +51110200202 +4101020200 +51010201029 +4101200002 +51012100025 +4101200020 +51210021007 +4101200200 +51112002002 +4101202000 +51012020108 +4101220000 +51210201007 +4102000201 +51020102015 +4102001200 +51120002104 +4102010002 +51100102024 +4102010020 +51022100019 +4102010200 +51020102019 +4102012000 +51120120002 +4102200001 +52110001206 +4102201000 +51122010002 +4102210000 +51022110006 +4110000022 +51100100225 +4110000202 +51100102025 +4110000220 +51100102205 +4110002002 +51100020128 +4110002020 +51101020204 +4110002200 +51112000023 +4110020002 +51011200027 +4110020020 +51100200219 +4110020200 +51100212006 +4110022000 +50112201009 +4110200002 +51211000027 +4110200020 +51102000219 +4110200200 +51112002003 +4110202000 +51102020108 +4110220000 +51112200003 +4112000002 +51011002027 +4112000020 +52110001209 +4112000200 +51120102005 +4112002000 +52112001009 +4112020000 +52110201009 +4112200000 +51122000019 +4120000021 +51102020014 +4120001020 +51012020107 +4120001200 +51122000104 +4120010002 +51002110028 +4120010020 +51012120007 +4120012000 +50212101009 +4120020001 +51102200014 +4120021000 +51211200003 +4120200001 +51202100015 +4120201000 +51202110005 +4120210000 +51202110006 +4121000020 +51210001207 +4121000200 +51210102005 +4121020000 +51211200004 +4121200000 +51211020006 +4122010000 +51012102007 +4201020100 +51100202018 +4201100020 +51012000129 +4201100200 +52121000018 +4201120000 +52111200002 +4202101000 +52121010002 +4210000012 +52101010024 +4210002010 +51201010029 +4210010002 +51120102003 +4210010020 +50121100206 +4210010200 +51120100023 +4210012000 +52101120004 +4210020010 +51120200103 +4210100002 +52101100025 +4210102000 +52101020019 +4210120000 +52101210006 +4210210000 +50121120006 +4212000010 +52120100105 +4212010000 +52121100004 +4212100000 +52111002007 +4220101000 +52201110005 +4221000100 +52112001004 +4221100000 +51221010006 +5001110220 +60211102202 +5010101202 +62101012021 +5010101220 +62101012201 +5010112002 +60121100227 +5010112020 +62101120201 +5010121020 +62101210201 +5010121200 +62101210023 +5011100220 +62111002201 +5011120200 +62111202001 +5011200120 +61102020216 +5011220100 +61100222019 +5012110002 +60121102027 +5012110020 +60121122007 +5012110200 +60121122008 +5012112000 +60121122007 +5021110200 +60211102208 +5100011202 +61200112022 +5100011220 +61002112204 +5100211002 +61002112027 +5100211020 +61002110229 +5100211200 +61002112208 +5101000212 +61210002122 +5101002102 +61010221025 +5101002120 +61010021229 +5101010202 +61010102228 +5101010220 +61210102202 +5101020102 +61210201022 +5101020210 +61012200126 +5101022100 +61210201204 +5101100022 +61011002227 +5101100202 +61011022026 +5101100220 +61011002229 +5101102002 +61011022027 +5101102020 +61011022207 +5101102200 +61011022208 +5101120002 +61011220026 +5101120020 +61011220206 +5101120200 +61011202208 +5101122000 +61011220208 +5101200012 +61012022106 +5101200210 +61012202105 +5101202010 +61012022109 +5101210002 +61012102027 +5101210020 +61012100229 +5101210200 +61212102002 +5101212000 +61012122009 +5101220010 +61012202107 +5102001210 +61220012102 +5102011200 +61020112208 +5102101002 +61021210025 +5102101020 +61120022107 +5102121000 +61221210002 +5102201010 +61222010102 +5102211000 +61222110002 +5110000221 +61120002213 +5110001202 +62111002023 +5110001220 +61100012229 +5110002012 +61120020123 +5110002201 +61100222015 +5110010022 +61100102227 +5110010202 +61100102228 +5110010220 +61100122206 +5110012002 +61102120024 +5110012020 +61102120204 +5110012200 +61100122208 +5110020012 +61021210027 +5110020021 +61102200214 +5110020201 +61102202014 +5110021020 +61102210204 +5110021200 +61102212004 +5110022010 +61102220104 +5110102002 +61121020023 +5110102020 +61121020203 +5110120002 +61101220026 +5110122000 +61101220208 +5110200021 +61122000213 +5110200201 +61102022016 +5110201002 +61102010228 +5110201020 +61102210205 +5110201200 +61102212005 +5110202001 +61102220015 +5110202010 +61221010207 +5110210002 +61102102027 +5110210020 +61102102207 +5110210200 +61102102208 +5110212000 +61102120208 +5110220001 +61102202017 +5110221000 +61102210208 +5112000012 +61122000124 +5112000201 +61120002218 +5112000210 +61120202105 +5112001200 +62111002029 +5112002010 +61120220105 +5112010002 +61120100228 +5112010020 +61120102207 +5112010200 +61120122006 +5112012000 +61120120208 +5112020010 +61122200104 +5112100002 +61121000228 +5112100020 +61121022007 +5112100200 +61121002029 +5112102000 +61121022007 +5112120000 +61121200208 +5112200001 +62112021006 +5112200010 +61122020106 +5112201000 +61122012007 +5112210000 +61122100208 +5120011020 +61202110204 +5120011200 +61200112208 +5120021010 +62211200103 +5120101002 +61221010023 +5120121000 +61221210003 +5120201010 +61202010129 +5120211000 +61202110208 +5121000102 +61210201025 +5121000120 +61210021206 +5121000210 +61210202105 +5121002100 +61212021004 +5121010020 +61210102207 +5121010200 +61212100026 +5121020010 +61212200104 +5121020100 +61212201004 +5121100002 +61211020026 +5121100020 +61211000229 +5121100200 +61211002029 +5121102000 +61211220005 +5121120000 +61211220006 +5121200010 +61212000129 +5121200100 +61212021006 +5121210000 +61212102007 +5122101000 +61221010029 +5201110020 +61022110206 +5201110200 +62011102208 +5210021100 +61022210108 +5210101002 +62101010228 +5210101020 +62101210205 +5210101200 +62121012003 +5210102001 +62101220015 +5210110002 +62121100023 +5210112000 +62121120003 +5210120001 +62101220018 +5210121000 +62101210208 +5211000120 +62112001204 +5211020100 +62110201208 +5211100020 +62111200205 +5211100200 +62111022006 +5211120000 +61122210006 +5211200100 +62112201005 +5212100001 +62122011006 +5212101000 +62121010208 +5212110000 +62121100029 +5221100010 +62211200105 +5221110000 +61220112009 +6010112022 +71102112207 +6010121202 +72121210108 +6010121220 +71101210223 +6011120220 +71111202201 +6011220120 +71012211209 +6012110022 +72101112206 +6012110202 +71121102021 +6012112020 +71222110109 +6012112200 +71121122001 +6021110220 +71102120126 +6100211022 +71212102107 +6100211202 +72122111008 +6100211220 +71011120223 +6101002122 +71010121225 +6101020212 +71110202122 +6101022102 +71110221022 +6101022120 +71212201019 +6101102022 +71111020222 +6101102202 +71120011228 +6101102220 +71011022219 +6101120022 +71110221027 +6101120202 +71011212026 +6101120220 +71011212206 +6101122002 +71111220022 +6101122020 +71012211209 +6101122200 +71120211208 +6101200212 +71112002122 +6101202210 +71012122105 +6101210022 +71112100222 +6101210202 +71012102128 +6101210220 +71011120226 +6101212020 +71210121209 +6101212200 +71112122002 +6101220012 +71120211206 +6101220210 +71011202219 +6102011220 +71120122104 +6102101022 +71112002127 +6102121002 +71121210022 +6102121020 +71112200127 +6102211020 +71122100219 +6102211200 +71122112002 +6102221010 +71122210102 +6110002221 +71112001223 +6110012022 +71112102203 +6110012202 +71121100224 +6110012220 +71112100223 +6110020221 +70111221026 +6110021202 +71111202023 +6110021220 +71101212204 +6110022012 +71112202103 +6110022201 +71122200118 +6110102022 +71111020223 +6110122002 +71111200227 +6110122020 +71111220203 +6110200221 +71110021223 +6110201022 +71111022203 +6110201202 +71111022023 +6110201220 +70111021229 +6110202012 +71112022103 +6110202021 +71102120215 +6110202201 +71102122015 +6110210022 +71112100223 +6110210202 +71221110028 +6110210220 +71102102219 +6110212002 +71211100227 +6110212020 +71211120207 +6110212200 +71221110208 +6110220021 +71212211007 +6110220201 +70111221026 +6110221002 +71111222003 +6110221020 +71111220203 +6110221200 +71111220023 +6112000212 +72111002126 +6112000221 +71121022014 +6112001220 +72111021029 +6112002210 +71221012019 +6112010022 +71011122027 +6112010202 +72111102026 +6112010220 +71120112206 +6112012020 +71121120204 +6112012200 +72112101029 +6112020012 +72111202106 +6112022010 +71011212207 +6112100022 +71121010226 +6112100202 +71121102025 +6112102020 +71111022207 +6112102200 +71121122005 +6112120002 +71111202027 +6112120020 +71111222007 +6112122000 +71121220019 +6112200012 +71122100125 +6112200021 +71122100215 +6112200201 +71122102015 +6112201020 +71122011207 +6112201200 +71122012108 +6112202010 +71122120105 +6112210002 +71122100128 +6112210020 +71122110206 +6112210200 +71122112006 +6112212000 +71122120108 +6112220001 +71211202017 +6112220010 +71122200119 +6112221000 +71122211007 +6120011202 +72121100218 +6120011220 +71211100223 +6120121002 +71112200127 +6120201012 +71122011203 +6120211002 +71212100127 +6120211020 +71211120203 +6120211200 +71211120023 +6120221010 +71101220219 +6121000122 +71112021024 +6121000212 +71210102125 +6121002102 +71112001224 +6121002120 +71112021204 +6121010202 +71210102128 +6121010220 +71210101229 +6121020102 +71011222018 +6121020210 +71122211004 +6121022100 +71212201019 +6121100022 +71211100225 +6121100202 +71122011028 +6121100220 +71211012206 +6121102002 +71211120025 +6121102020 +71212011209 +6121102200 +71211122005 +6121120002 +71112201027 +6121120200 +71211212006 +6121122000 +71211220108 +6121200012 +71122011206 +6121200102 +71211022016 +6121200210 +71212102105 +6121202010 +71212120105 +6121202100 +71212011208 +6121210002 +71212101027 +6121210020 +71211120206 +6121210200 +71211120026 +6121212000 +71212121007 +6121220010 +71212211007 +6121220100 +71212211006 +6122001210 +71122012104 +6122011200 +72112101029 +6122101002 +71221110025 +6122101020 +71221110205 +6122101200 +71221112005 +6122121000 +71102212108 +6122201010 +71222110105 +6122211000 +72112101209 +6201110202 +71120102126 +6201110220 +72111102202 +6201112200 +71210102129 +6210101022 +71121012203 +6210101202 +71121012023 +6210101220 +71102012129 +6210112002 +71120112207 +6210112020 +71202110129 +6210121020 +71121210203 +6210121200 +72121210108 +6210122001 +71122211003 +6211020120 +71121200216 +6211100202 +72111002128 +6211100220 +71120011229 +6211102200 +72111022108 +6211120020 +71120211209 +6211120200 +71120211029 +6211200102 +71221012018 +6211200120 +71121020216 +6211202100 +72112121005 +6211220100 +71011202219 +6212100021 +71122011027 +6212100201 +72121102015 +6212101020 +72111022107 +6212101200 +72121112005 +6212110002 +72111102027 +6212110020 +72121100219 +6212110200 +72121112006 +6212112000 +72122111009 +6212120001 +71120211027 +6212121000 +72121210108 +6212201100 +71120011229 +6221110020 +71012122109 +6221110200 +72122111008 +6221120010 +71102212106 +7011102122 +80111221225 +7011122102 +80111221228 +7011122120 +82111221201 +7101102221 +81211022212 +7101112022 +81011122227 +7101112202 +81211122022 +7101112220 +81011122229 +7101120221 +81011222216 +7101121202 +81011212228 +7101121220 +81011212229 +7101122012 +81211220122 +7101122201 +81211222012 +7101210212 +81212102122 +7101212210 +81012122129 +7101221120 +81011222219 +7110021212 +82111202123 +7110112022 +81121120223 +7110121022 +81101212227 +7110121202 +81121212023 +7110121220 +81101212229 +7110122021 +81121220217 +7110201212 +81102212125 +7110211022 +81102112227 +7110211202 +81102112228 +7110211220 +81122112203 +7110221012 +82111222103 +7110221210 +81102212129 +7112001122 +81120211225 +7112011220 +81122112204 +7112021102 +81120211228 +7112021120 +81122211204 +7112101022 +81121210225 +7112101202 +81121012228 +7112101220 +81121012229 +7112102021 +81121022217 +7112102201 +81121022218 +7112110022 +81121122027 +7112110202 +81121122026 +7112112020 +81121122207 +7112112200 +81121122208 +7112120021 +81121220216 +7112121002 +81121210228 +7112121020 +81121212207 +7112122001 +81121220218 +7112201102 +81122011228 +7112201120 +81122011229 +7112201210 +81122012129 +7112211020 +82111122209 +7112211200 +81122112208 +7112220011 +82112221106 +7112221010 +82111222109 +7112221100 +81122211029 +7120211012 +82122111203 +7121010212 +81212102124 +7121100221 +81211202215 +7121101202 +81211212025 +7121101220 +81211012229 +7121102012 +81122011227 +7121102201 +81211022218 +7121110022 +81211102227 +7121110202 +81211122026 +7121110220 +81211102229 +7121112002 +81211122027 +7121112020 +81211122207 +7121112200 +81211122029 +7121120012 +81211220126 +7121120201 +81211222016 +7121121200 +81211212208 +7121122010 +81122211207 +7121201120 +81212211205 +7121202101 +81212221015 +7121210012 +81212122106 +7121210210 +81212122106 +7121212010 +81212122107 +7121220101 +81212221016 +7121221100 +81212211208 +7122011210 +81222112104 +7122101201 +81122022118 +7122211010 +81222112107 +7211100212 +82111202125 +7211102102 +82111221025 +7211102120 +82111221205 +7211102210 +81122012129 +7211110202 +81122112026 +7211110220 +82111102229 +7211112200 +82111122208 +7211120210 +82111222106 +7211122100 +82111221208 +7211202110 +81122022119 +7212101210 +82121012129 +7212110021 +82121122017 +7212110201 +82121122018 +7212121010 +82121212107 +7212211100 +82122111208 +7221121100 +81221212019 +8011122122 +91111221221 +8101122221 +91111222212 +8101212212 +91112122122 +8110221212 +91111222123 +8112021122 +91111222124 +8112102221 +91121122215 +8112112220 +91121122219 +8112121022 +91111222127 +8112122021 +91111222217 +8112201212 +91122112125 +8112202211 +91122122115 +8112211202 +91122112128 +8112211220 +92111121229 +8121102221 +91211122215 +8121112022 +91112121227 +8121112202 +91122111228 +8121112220 +91211122219 +8121121202 +91211212128 +8121122012 +91111222217 +8121122201 +91122211218 +8121202121 +91212121215 +8121212210 +91211122219 +8122211210 +91121122219 +8211102122 +92111121225 +8211112220 +91122111229 +8211122120 +91122211219 +8211122210 +91211212129 +8212101212 +92121112125 +8212112201 +91122112128 diff --git a/src/genetic.cpp b/src/genetic.cpp index b24ff24..89b5247 100644 --- a/src/genetic.cpp +++ b/src/genetic.cpp @@ -31,7 +31,7 @@ Genetic::~Genetic() void Genetic::run() { int generations = 0; - while (generations < 200 && this->max_fitness < 99.5) + while (generations < 200 && this->max_fitness < 140) { this->next_gen(); HistoryEntry entry; @@ -53,10 +53,10 @@ void Genetic::next_gen() { this->min_fitness = 10000; this->max_fitness = 0; - auto counts = map, int>(); + auto counts = map, tuple>(); for (auto p1 : *this->population) { - int losses = 0; + int losses = 0, won = 0, draw = 0; for (auto p2 : *this->population) { if (&(*p1) == &(*p2)) @@ -69,19 +69,32 @@ void Genetic::next_gen() g.run(); if (g.get_winner_id() == oid) losses++; + else if (g.get_winner_id() == pid) + won++; + else + draw++; } - counts[p1] = losses; + counts[p1] = tuple(draw, won, losses); } - auto countscount = map(); + auto countdraw = map(); + auto countlost = map(); + auto countwin = map(); for (auto& e : counts) - countscount[e.second]++; + { + countdraw[get<0>(e.second)]++; + countlost[get<1>(e.second)]++; + countwin[get<2>(e.second)]++; + } this->sum_fitness = 0; for (auto& e : counts) { - double fitness = 100 * (1 / (double)countscount[e.second]) * - (1 - ((double)e.second / (double)(Genetic::P - 1))); + //double fitness = 100 * (1 / (double)countscount[e.second.second]) * + //(1 - ((double)e.second.second / (double)(Genetic::P - 1))); + double fitness = 100 * (double)(get<2>(e.second) + get<0>(e.second)) + / (double)(Genetic::P - 1); + fitness -= 100 * (double)get<1>(e.second) / (double)(Genetic::P - 1); this->sum_fitness += fitness; e.first->set_fitness(fitness); if (fitness > this->max_fitness) @@ -158,6 +171,13 @@ void Genetic::save() char buffer[80]; strftime(buffer, 80, "%Y-%m-%d-%H-%M-%S",timeinfo); string time = buffer; + + for (auto& e : *this->population) + if (e->get_fitness() == this->max_fitness) + { + e->save("resources/individuals/" + time); + break; + } ofstream file; file.open("resources/histories/" + time); for (auto& e : *this->history) diff --git a/src/players/individual.cpp b/src/players/individual.cpp index efcc6b4..23802ae 100644 --- a/src/players/individual.cpp +++ b/src/players/individual.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "utils/make_unique.h" #include "players/individual.h" @@ -70,3 +71,34 @@ shared_ptr Individual::get_strategy() const return this->strategy; } +void Individual::load(std::string const& path) +{ + this->strategy->clear(); + + ifstream file; + file.open(path); + + string line; + while (getline(file, line)) + { + string next; + getline(file, next); + auto entry = pair(next[10] - '0', + BSM::board(next.substr(0, 10))); + string bs = BSM::board(line.substr(0, 10)); + this->strategy->insert(pair>(bs, entry)); + } +} + + +void Individual::save(std::string const& path) +{ + ofstream file; + file.open(path); + for (auto& e : *this->strategy) + { + file << BSM::str(e.first) << endl; + file << BSM::str(e.second.second) << e.second.first << endl; + } +} + diff --git a/src/players/individual.h b/src/players/individual.h index 621ebaf..b3ce66e 100644 --- a/src/players/individual.h +++ b/src/players/individual.h @@ -23,6 +23,9 @@ class Individual : public Player std::shared_ptr get_strategy() const; + void save(std::string const& path); + void load(std::string const& path); + private: float fitness; std::shared_ptr strategy; diff --git a/src/tictacgen.cpp b/src/tictacgen.cpp index 6f094f5..44f02d7 100644 --- a/src/tictacgen.cpp +++ b/src/tictacgen.cpp @@ -17,14 +17,15 @@ int main(int argc, char *argv[]) srand(time(NULL)); BSM::load("resources/states"); - Genetic genetic; + //Genetic genetic; - genetic.run(); + //genetic.run(); - //auto p1 = make_shared(1); - //auto p2 = make_shared(2); - //Game g(p1, p2); - //g.run(2); + auto p1 = make_shared(2); + p1->load("resources/individuals/2014-04-20-19-26-07"); + auto p2 = make_shared(1); + Game g(p1, p2); + g.run(2); return 0; }