diff --git a/src/CheckersGameState.java b/src/CheckersGameState.java index 8d9f4b7..0a636ac 100644 --- a/src/CheckersGameState.java +++ b/src/CheckersGameState.java @@ -7,4 +7,6 @@ boolean isTerminal(); int winner(); void printState (); public double[] getFeatures(int player); +public boolean isEndGame(); +public double[] getEndGameFeatures(int player); } diff --git a/src/CheckersGameState3.java b/src/CheckersGameState3.java index 64864d7..0b77de1 100644 --- a/src/CheckersGameState3.java +++ b/src/CheckersGameState3.java @@ -388,9 +388,9 @@ public class CheckersGameState3 implements CheckersGameState{ /* computes feature vector: [0: piece-ratio, - 1: loners, - 2: safes, - 3: 1*#pawns+ 2*#kings + 1: loners, //toss? + 2: safes, /toss? + 3: 1*#pawns+ 2*#kings //toss? 4: # of moveable pawns + 2*#of moveable kings 5: aggregate distance of all pawns to promotion line 6: promotion line opening @@ -399,6 +399,9 @@ public class CheckersGameState3 implements CheckersGameState{ 9: central pieces 10: # pawns on diagonal + 2 * # kings on diagonal 11: ^ same but for the two smaller diagonals + 12: bridge pattern TODO!!! + 13: triangle pattern TODO + 14: dog pattern TODO ] */ private boolean king(int piece){ @@ -452,18 +455,13 @@ public class CheckersGameState3 implements CheckersGameState{ /* computes feature vector: [0: piece-ratio, - 1: # of moveable pawns + 2*#of moveable kings - 2: num attacking pieces - 3: central pieces - 4: # pawns on diagonal + 2 * # kings on diagonal - 5: bridge pattern - 6: triangle pattern - 7: dog pattern - 8: opponents kings are on the side. + 1: num attacking pieces + 2: central pieces + 4: opponents kings are on the side. ] */ public double[] getEndGameFeatures(int player){ - double[] features = new double[9]; + double[] features = new double[4]; double total = 0.0; double mypieces = 0.0; for(int i = 0; i0){ + if(currentState.isEndGame() && minPly < maxPly){ + minPly+=incPly; + } currentState.printState(); Move myMove = ai.minimax(currentState, minPly); writeMessageAndEcho(myMove.toString()); diff --git a/src/weights/alpha.csv b/src/weights/alpha.csv index 7b73f51..e82b8bf 100644 --- a/src/weights/alpha.csv +++ b/src/weights/alpha.csv @@ -211,3 +211,28 @@ 1636.0393033795276, -20.55866486325862, 23.025889823117954, -75.23311382312917, 49.441644873926144, 6.656444927678631, 47.95237701100202, 30.800919183379587, 8.737729875300932, 15.591634738689757, -30.83579903277091, -4.031769509694296 1638.2330874898776, -20.221504696957055, 21.744347638396736, -75.05160182683231, 48.83751050422706, 6.5445299914688295, 47.92011127154682, 30.690614802855197, 9.967706216168144, 13.976829859173037, -29.54516847523072, -3.3459437553953135 2799.5131611566608, -1.944668143409672, -6.07582076732366, -15.020040153383759, -0.38978985234549934, 5.102487827528079, 45.55197753549653, -7.961856581907668, -11.80237286431448, 1.2111733368909983, -3.063047124671007, 1.986352732898951 +2819.123748375204, -6.3502535298600105, -12.782558494485961, -7.292852848933818, -0.34712863449470116, 4.917424359698483, 51.52717394754892, -9.716311931796048, -20.60575146529882, 4.690311528963438, -6.6904730690626675, -4.885008568879172 +2823.7446931293407, -6.29819815688049, -10.661822965976196, -6.7179388970924725, 0.43509391896474064, 5.377385681697625, 51.04893695097747, -13.79295452751498, -26.5558837919409, 6.703762568051382, -11.747926161739754, -5.270919246804665 +2840.2410977224113, -6.982205055127192, -14.270865238837677, 0.0649634752429078, 0.983244881353248, 5.424374030317277, 50.859465066349514, -23.368679207396433, -32.490947173688326, 5.813021305023193, -16.315816745530043, -3.3824852380287576 +2930.0759464993153, -7.475710209838357, -9.612411441279239, -5.235937792581098, 1.3838623977516014, 4.999786158654082, 47.85803299232243, -21.860026155742975, -26.281150310291814, 7.629445546858122, -16.679703156639718, -7.54927040318127 +2915.634547791944, -6.155932093735857, -7.437770238798674, -5.982694556061574, 2.406985715038655, 5.5070306373241005, 49.263643689530404, -24.094411217071627, -29.806335014955074, 8.868834095293115, -21.544784781138258, -8.007468729955562 +2916.3063867724754, -5.090974263375936, -5.7475356179133685, -3.0000089120278237, 2.961712708417279, 5.202094822036985, 49.73462697381358, -25.65311612596431, -31.692968955259055, 10.093493760085153, -23.36610562733877, -11.318307728443557 +2910.6037930335715, -4.131480703581557, -3.384797837430957, -2.4614155649218983, 3.96525058934255, 5.130895295637674, 51.3901096405062, -26.45318923869011, -32.77151303224894, 10.445634416200377, -24.88664222837126, -13.441509241110161 +2826.156464386087, 0.120654506825419, -7.921606712227613, -0.007493788059202089, 3.6459310804814087, 2.943790575230708, 51.309264952328874, -12.272800488023764, -20.526722380754606, 4.447955817145174, -24.404895648453053, -9.977299510528816 +2890.0509629519224, -0.24841380284418302, -10.06800238045122, -11.89635912346341, 4.248187314434739, 5.538302742307144, 46.00945500731964, -22.951226349297645, -18.53689178814173, -3.78533171766298, -21.686305337007788, -7.97403472924687 +3053.6351606943517, -4.535600585874046, -2.2983305806248966, -40.361736552612264, 7.425974961410926, 7.41221443110567, 54.553462416869316, -13.738248190693737, -13.356873363084443, 4.896381913265503, -24.399191578047574, -12.746350650863311 +3048.005198736501, -4.735716530236788, 3.663875680414705, -37.7827217427352, 8.030215511211464, 5.878278318292642, 47.152112961823406, -9.922687389533893, -10.554796090122949, 3.1702406568484314, -17.797956030581425, -15.604065107244708 +3079.370000718198, -5.131876501635187, 1.715400609589258, -24.784829575650356, 5.295428366203243, 3.213673094101617, 49.533288020742546, -6.729145452058781, -7.995782503571347, -2.5450832140924087, -17.2506642972572, -14.944125696430765 +3081.6727079706793, -3.2872127242650073, 1.458785211833281, -40.72124724997096, 6.19701481147274, 5.464559220835012, 51.575911886395765, -4.578395062433524, -7.728822815188389, -0.2189230159444313, -22.61867238916366, -11.758952149223031 +3100.5084142500564, -4.7822912723109425, 3.174046215948167, -48.4463988093916, 6.524498081200537, 6.8956268885655225, 47.68804037824094, -7.465031715178685, -4.95086101961026, -0.9444266862838813, -23.55601409327474, -14.247370015730638 +3086.0716127466712, -4.266333646434264, 2.9108110658071134, -46.85542852832165, 6.829583344179504, 6.888696844489375, 46.92563133095181, -7.888991333409911, -6.828408083298225, -0.22573821763479163, -23.820217324903048, -15.486849298053645 +3075.439468718722, -3.900817870065693, 2.772591480311922, -45.86352953252236, 7.050201708903726, 6.900291052961852, 46.432058750418484, -8.172569864726556, -8.133357839316867, 0.2866955474259578, -23.96810889364606, -16.36868013961241 +3066.0441536915196, -3.580218365020854, 1.905518087399917, -42.816689655123, 6.81038469233651, 6.5028427874476815, 47.01603071348958, -7.708956312075114, -8.121513147201496, 0.35191888044090336, -24.336300767153364, -17.476931106389607 +3076.7942658791485, -3.9944372443193163, 1.203168899836871, -43.693533074303204, 7.046836478795926, 6.925610791602731, 46.47422315356045, -9.112299466489374, -9.291575137674116, 1.3828658839626127, -25.545464757418088, -19.754054491277657 +3098.5061664217824, -4.120409201219323, 5.233125121651318, -21.88854412094254, 5.321639505789649, 1.6455419406899825, 40.65443087306163, -1.2550577340357156, -3.5673003675540613, -0.5575663360816563, -25.63658028613234, -18.17349554676609 +3083.644320166879, -3.620041738133389, 6.506829274602694, -16.464437353199763, 3.8587553281814166, 1.1676713046461837, 43.07479634076473, -2.275512636169418, -7.0002860307231245, 2.524302029924657, -29.68186724227588, -16.4965294631963 +3244.672855653226, -2.8337649893998282, 13.710741992200896, 1.3044067693043608, -1.888187868834577, -0.9119398457052705, 36.58249580806826, -17.04662114943008, -19.793069361154778, 6.7567700567497075, -27.312743879170498, -16.262337453131046 +2917.746487334786, -8.061022951931838, -6.609964398233794, 216.8151169367727, 14.424076364525142, -0.4061740154502895, 34.81363162472649, -245.631559007009, -222.57909067895224, -5.493888974372356, -17.56719556954635, -25.27984840693994 +2894.5183569896217, -24.261531583697504, 15.034595717336051, 178.48968012671259, 23.70426382401744, 5.441287376691758, 49.0007935946269, -259.1269445462735, -232.5596315889493, -5.329598328618745, -6.994636135055675, -13.244975077862328 +2944.668512245323, -25.21731850468463, 14.854772185388837, 187.44524414324124, 19.682623746127724, 4.2729992145885, 44.46179377944801, -261.69593216723047, -232.53545342651304, -1.472468962139943, -8.644497633245395, -17.22580253861976 +3009.069370626828, -24.285677007924463, 24.688977766025346, 176.62705146719483, 6.447126303312221, 2.783552147365609, 28.749676932008803, -235.2302515085287, -203.36431054211803, 4.213613222647522, -20.234164528178965, -33.25310964667955 diff --git a/src/weights/beta.csv b/src/weights/beta.csv index b531046..b031447 100644 --- a/src/weights/beta.csv +++ b/src/weights/beta.csv @@ -1,3 +1,4 @@ 100, -5, 20, 20, 25, 10, 10, 20, 20, 30, 30, 30 1826.0705815169833, 12.365435899024902, 23.58295734807525, 57.36085478839676, -2.7837546960554285, -3.19771921999838, 47.08341161233382, -6.285784896148243, -5.208189183870571, 11.51522034240242, -3.2044344558613282, -8.223757596191781 2799.5131611566608, -1.944668143409672, -6.07582076732366, -15.020040153383759, -0.38978985234549934, 5.102487827528079, 45.55197753549653, -7.961856581907668, -11.80237286431448, 1.2111733368909983, -3.063047124671007, 1.986352732898951 +3076.7942658791485, -3.9944372443193163, 1.203168899836871, -43.693533074303204, 7.046836478795926, 6.925610791602731, 46.47422315356045, -9.112299466489374, -9.291575137674116, 1.3828658839626127, -25.545464757418088, -19.754054491277657 diff --git a/src/weights/endalpha.csv b/src/weights/endalpha.csv new file mode 100644 index 0000000..60f2e9e --- /dev/null +++ b/src/weights/endalpha.csv @@ -0,0 +1,40 @@ +4, 1, 1, 1 +4.313828842716437, 1.8857242375188283, 0.8126615121263876, 0.9530086474031043 +7.241580697733099, 1.6691773399449938, 0.735304318165549, 0.944596628319762 +10.11049159676462, 1.46792206262981, 0.6725383945773854, 0.803000180291029 +12.095697117883343, 1.378222180864029, 0.504792968112257, 0.7865085075500864 +14.086033012262202, 1.2721365402954716, 0.4155616330280853, 0.7290378560645496 +15.827367362865312, 1.194743883780101, 0.334198165575756, 0.7023404195614699 +17.367087144772675, 1.1394694383289898, 0.26268951647520355, 0.7012623259055106 +19.47984841848771, 0.9237239869861492, 0.2723581626414104, 0.6543479055397609 +21.36077525744421, 0.7366922692475871, 0.25007805752716666, 0.5790802342481647 +23.056212730907088, 0.6124845661032596, 0.14988128423475783, 0.513952428506267 +24.449320393319276, 0.4847870586825279, 0.0965934253742993, 0.4319004909491842 +25.813497205265193, 0.22426951737019568, 0.08272835882821461, 0.373522143736303 +26.473200054909043, 0.20144397298126865, 0.07952647437081806, 0.3365685220145802 +27.006158104154736, 0.19656474035889046, 0.10750834334692067, 0.34919995249613606 +27.477137706147065, 0.21037832552286595, 0.1292063746517942, 0.3597280857440115 +27.977863510018867, 0.22325849864432806, 0.14954614747887557, 0.36861114713478516 +28.626143454274146, 0.11725619449058818, 0.229389553221989, 0.33287488614500926 +29.755578870788618, 0.08346854496174053, 0.10178999810453868, 0.6309486438623892 +30.406200473691857, -0.01789802731704908, 0.2331436063290136, 0.6581617500895035 +31.6786996934737, -0.007985074913278612, 0.23219623225059888, 0.6251936720764905 +32.53852854524174, 0.09734457397539918, 0.2137679817495659, 0.5574628829776317 +33.02379399157615, 0.013259513791188199, 0.2743057856684519, 0.7345751406392189 +33.758859631952944, -0.012252171709360202, 0.31511338663725474, 0.726070510269984 +34.326731345094515, -0.03067712817031271, 0.27955439152713674, 0.6801602178664948 +34.78919087708405, -0.07772825115739608, 0.2560438518263545, 0.6656119626789027 +35.11971100966663, -0.11142107572326859, 0.23840072012621913, 0.6550590707777117 +35.24752293715904, -0.10860532210511806, 0.2408947329951694, 0.6458897700867499 +35.41458685074348, -0.12660091281723881, 0.23550977161692704, 0.613271461412759 +36.82036131998706, -0.21614470843721026, 0.2252527732360719, 0.4822568288400138 +37.426091330816085, -0.13936461091436772, 0.1811887629495364, 0.2757522502160047 +37.98116015047986, -0.19091256013626715, 0.17193403223755002, 0.26724787561992774 +38.55029197212103, -0.22283483205017757, 0.12503996491496477, 0.18650324626007603 +38.99217372508795, -0.24964647942333806, 0.09340164720930452, 0.11321172163841911 +39.0202293091678, -0.20692759716550557, 0.15429782700695405, 0.18840392636816794 +39.11231247497888, -0.1708347634808915, 0.2132409825623508, 0.28034795030618187 +36.6147644947839, 0.0747619961715664, 0.5581918496787839, -0.030423498185017717 +34.29346261669157, 0.2951876167857882, 0.8181508834781575, -0.29541606264372866 +33.584381554011266, 0.42623870908829853, 0.8037138081798451, 0.004191978488671644 +34.30151414858097, 0.39430957833943214, 0.7561481295223783, -0.005064739062742088 diff --git a/src/weights/endbeta.csv b/src/weights/endbeta.csv new file mode 100644 index 0000000..92e42a1 --- /dev/null +++ b/src/weights/endbeta.csv @@ -0,0 +1,2 @@ +4, 1, 1, 1 +35.41458685074348, -0.12660091281723881, 0.23550977161692704, 0.613271461412759