BL2 Bot Player

Discuss about Blockout II from Jean-Luc, post your feature requests etc.
Lieven
Posts: 55
Joined: Sun Aug 05, 2007 6:31 am

Re:BL2 Bot Player

Post by Lieven »

I am impressed! If you have time, could you run it on 3x3x6 flat? Perhaps, it should be possible to play infinite in this mode. Otherwise definitely in 3x3x7 or 3x3x8. I remember I was quite disappointed how poor my evaluation did in these modes.
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

3x3x6 FLAT: No endless playing yet ;) But here i think
that the strategy is not really the same. I didn\'t
try to optimize this more yet.

[ 39] Cube=9256 Avg=25848.3
[ 40] Cube=19722 Avg=25698.9
[ 41] Cube=9900 Avg=25322.7
[ 42] Cube=388 Avg=24742.8
[ 43] Cube=1589 Avg=24216.6
[ 44] Cube=66789 Avg=25162.7
[ 45] Cube=25523 Avg=25170.5
[ 46] Cube=2094 Avg=24679.5
[ 47] Cube=8913 Avg=24351
[ 48] Cube=2853 Avg=23912.3
[ 49] Cube=15933 Avg=23752.7
[ 50] Cube=1016 Avg=23306.9
[ 51] Cube=37526 Avg=23580.3
[ 52] Cube=26617 Avg=23637.6
[ 53] Cube=36044 Avg=23867.4
[ 54] Cube=29778 Avg=23974.9
[ 55] Cube=10004 Avg=23725.4
[ 56] Cube=881 Avg=23324.6
[ 57] Cube=2759 Avg=22970
[ 58] Cube=21486 Avg=22944.9
[ 59] Cube=2858 Avg=22610.1
[ 60] Cube=7263 Avg=22358.5
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

May be endless playing in 3x3x10.
Tried 1 million cube.

Avg=1e+006 Min=### Max=1000001 nbGame=1
1min 52sec, 8902.19 cps
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

3x3x7 FLAT:
Avg=62106 Min=62106(14773166) Max=62106 nbGame=1
0min 06sec, 10149.7 cps

3x3x8 FLAT:
Avg=1e+006 Min=### Max=1000003 nbGame=1
1min 54sec, 8770.88 cps

I could be interesting to study how the avg
increase with the depth (May be exponential ???)
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

God damn ! No endless play in 3x3x8 FLAT !

[ 0] Cube=1000003 Avg=1e+006
[ 1] Cube=1000001 Avg=1e+006
[ 2] Cube=1000001 Avg=1e+006
[ 3] Cube=1000001 Avg=1e+006
[ 4] Cube=1000001 Avg=1e+006
[ 5] Cube=1000001 Avg=1e+006
[ 6] Cube=1000001 Avg=1e+006
[ 7] Cube=1000003 Avg=1e+006
[ 8] Cube=1000001 Avg=1e+006
[ 9] Cube=847884 Avg=984790
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

Anyway, a quick tuning of coefficients:

3x3x6 BASIC
Avg=1525.65 Min=35(21194651) Max=12230 nbGame=1000
2min 44sec, 9321.23 cps
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

I added the \"hole coverage\" management. No significant increase :(
However, coefficients may need a bit tuning.
I will now try to learn more from short games....

Avg=1516.52 Min=32(32235773) Max=15191 nbGame=10000
31min 08sec, 8120.52 cps
(On my OLD P4 1,7GHz)

I let you informed...

To Lieven:

It would be great and I would really appreciate if you can spend
a bit of your time on the stats problems. I had a look at the
cumulative distribution, and it looks to converge rapidly. May
be we can use this to fit to the equation in order to
approximate the avg.... Just an idea....
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

OK, i uploaded the new source to sf.net. The trick of
the srand(yourSeed) can always be done. Useful to
study short games in Practice Mode.
If you are in DEBUG configuration, you can have the
evaluation details on screen (Practice Mode). By pressing
[H] (Help mode) you can see what the AI would play.
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

Last results, a small improvement of the death zone gave ~30cubes
i think. Improvements still possible....

Code: Select all

  // Stats:  Avg=1540.52 Min=32(13005640) Max=15172 nbGame=5000
  // 3x3x6 BASIC:
  float linesNote     =  3.5f  * nbLines;            // Line (layer)
  float pitNote       =  0.25f * GetPitNote();       // Edge,corner,distance,death zone
  float smooth2Note   = -0.03f * Smoothness2();      // Pit surface smoothness (sqr)
  float commonNote    =  7.0f  * commonEdge;         // Puzzle solver
  float nbHoleNote    = -1.1f  * GetNbHole();        // Hole
  float coveredNote   = -0.02f * GetNbCoveredHole(); // Covered hole

  float totalNote=pitNote+smooth2Note+commonNote+linesNote+nbHoleNote+coveredNote;
Lieven
Posts: 55
Joined: Sun Aug 05, 2007 6:31 am

Re:BL2 Bot Player

Post by Lieven »

I have a problem with compiling again:

Code: Select all

Game.cpp
..\\Game.cpp(136) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(181) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(188) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(198) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(207) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(248) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(260) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(270) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
..\\Game.cpp(280) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
BotPlayer.cpp
BlockOut.cpp
..\\BlockOut.cpp(257) : warning C4996: \'sprintf\' was declared deprecated
        C:\\Program Files\\Microsoft Visual Studio 8\\VC\\include\\stdio.h(345) : see declaration of \'sprintf\'
        Message: \'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.\'
Generating Code...
Linking...
BotPlayer.obj : error LNK2019: unresolved external symbol \"private: void __thiscall BotPlayer::InitPitCoef(void)\" (?InitPitCoef@BotPlayer@@AAEXXZ) referenced in function \"public: void __thiscall BotPlayer::GetMoves(class Pit *,class PolyCube *,int,int,int,struct AI_MOVE *,int *)\" (?GetMoves@BotPlayer@@QAEXPAVPit@@PAVPolyCube@@HHHPAUAI_MOVE@@PAH@Z)
BotPlayer.obj : error LNK2019: unresolved external symbol \"private: float __thiscall BotPlayer::Evaluate(void)\" (?Evaluate@BotPlayer@@AAEMXZ) referenced in function \"public: char * __thiscall BotPlayer::GetInfo(class Pit *,struct BLOCKITEM *,int)\" (?GetInfo@BotPlayer@@QAEPADPAVPit@@PAUBLOCKITEM@@H@Z)
.\\Debug/BlockOut.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at \"file://c:\\games\\bl2\\BlockOut\\VC8\\Debug\\BuildLog.htm\"
BlockOut - 3 error(s), 10 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I probably forgot to download a specific source file, but can\'t seem to find it.
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

It looks like you have forget to rebuild,
Or forget to add the BotPlayerAI.cpp to the project,
Or not defined the symbol AI_TEST in \"project properties\"->\"C++\"->Preprocessor
Let me know...

Anyway, i normalized the smoothness sqr function and
use sigma(delta^2)^1.5 instead of sigma(delta^2). Seems
to detect a bit better \"1 cube size pit\".

[3567] Cube=2164 Avg=1593.17
[3568] Cube=2605 Avg=1593.46
[3569] Cube=315 Avg=1593.1
[3570] Cube=1104 Avg=1592.96
[3571] Cube=1411 Avg=1592.91
[3572] Cube=1685 Avg=1592.94
[3573] Cube=1498 Avg=1592.91
[3574] Cube=1546 Avg=1592.9
[3575] Cube=1485 Avg=1592.87
[3576] Cube=152 Avg=1592.46
[3577] Cube=148 Avg=1592.06
[3578] Cube=3729 Avg=1592.66
[3579] Cube=153 Avg=1592.26
[3580] Cube=1009 Avg=1592.09
[3581] Cube=440 Avg=1591.77
Lieven
Posts: 55
Joined: Sun Aug 05, 2007 6:31 am

Re:BL2 Bot Player

Post by Lieven »

Thanks for the quick answer, yes I forgot to include BotplayerAI. The code looks impressive and it will take me some time to understand.


You asked: It would be great and I would really appreciate if you can spend
a bit of your time on the stats problems. I had a look at the
cumulative distribution, and it looks to converge rapidly. May
be we can use this to fit to the equation in order to
approximate the avg.... Just an idea....

Could you expand a bit on this? I think the plain average is the best one can do, but I will look into it. In any case I think it is possible to write down a simple formula (far less complicated than what I wrote before) on the 68% confidence interval. I will try that tomorrow.

The problem of determing the average number of blocks depending on the depth is also interesting. I think it can be modelled as a random walk (where you walk up and down the pit).
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

Last results:

Avg=1602.17 Min=32(45850849) Max=12057 nbGame=1000
4min 06sec, 6521.8 cps

Thanks you very much for having a look at the stat stuff :)
You\'re definitely much better than me in this domain.
I only have a quick look at this 68% confidence interval.

What I would suggest is to try to fit the equation of the
cumlative distrib to the experimental one. It becomes
rapidly smooth. But that suppose that the distrib is a
Poisson one.
I let you decide what is the best way to do that....
The goal is to make a reliable \"coefficient scanner\".

The code is less complex than it looks like. Here is the coordinates
system of the pit (Right handed) which can be useful.

Image<br><br>Post edited by: jlp_38, at: 2008/02/16 00:14
Lieven
Posts: 55
Joined: Sun Aug 05, 2007 6:31 am

Re:BL2 Bot Player

Post by Lieven »

Ok I thought a bit about the statistics problem and how to speed up calculation of the average

The idea of random walk might actually be very fruitful: Currently, all what we keep from one game is one number.
Although one game gives a lot more information!

Jean-Luc, would you mind doing a little test for me? I am really tied up and don\'t have time to program it myself.

Could you run say 100 3D mania games (or 3x3x18) games with an evaluation code which is not dependent on depth and tabulate the following:

Code: Select all

   D     P1      P2      P3
   0      0
   1
   2
   3
...


Where for a given D=depth-freedepth P gives the
P1(D)= probability that freedepth increases
P2(D)= probability that freedepth decreases
P3(D)= probability that freedepth stays the same
Obviously P1(D)+P2(D)+P3(D)=1 and P1(0)=0

The tabulation can be done just by counting the times freedepth increases/decreases, and at the end of the run dividing every row r through
the sum of that row r.

The idea is that if the probabilities are roughly independent from the depth, say when D>=2, then by running the game say just 10 times, we will have
accurate probabilities for the low depths, and hence since they are equal to those on higher depths, we can estimate the table accurately with a low number of runs.

Then it should be easy to estimate the average, without any further runs. This is just an idea, but would be interesting to try.

I am sorry I don\'t have the time to try this myself.

Lieven<br><br>Post edited by: Lieven, at: 2008/02/16 17:59
jlp_38
Posts: 264
Joined: Tue Jun 26, 2007 9:09 am

Re:BL2 Bot Player

Post by jlp_38 »

Hi Lieven,

Thank you very much for you job. :)
Really interesting !
I\'m going to make the tests you ask.

Anyway,

I think I have found \"death sequences\" for 3x3xX BASIC.
A sequence of n same consecutive blocks:

Image
Image
Image

seems to be fatal, It is possible to make few lines but
the freedepth decrease inexorably. I didn\'t find out
a way to make enough lines. If a solution exists,
it would be great !
The current evaluation fails after ~40 cubes each time.

This has dramatic impacts for the min-max as it will always
find a minimun note.

I\'m currently normalizing the eval and try to make the
more \"free\" possible all coefficients.

I let you informed.
Post Reply