Feel free to send your feedback or ask some help here!
Hello everybody.
My actual rank is #41 in league gold, and (with the advisory of marchette) my priority in score evaluation is the nearest distance to opponent.
Before i continue, what will be the more importante : including surface evaluation in the score or a MinMax or other else.
Tx
Enemy detection in the fog.
Yes, this is what i mean by saying ānearest distance to opponentā. At this time, i have a simple fog detection like the cell around every build event in the fog.
For a push from the fog, there is max 3 cells around the build cell, and for a move in the fog, a max of 8 cells around the build cell.
I am in hesitation to accurate it with the failed move or failed push, and so and so, before implementing other strategies like control surface score or minmax etcā¦
Hello everybody, Iām new in CodinGame and Iām not very good in Js. Here is my code for wondev woman in Wood League 2. I want to make my character to move around the center, but it doesnāt work. Sorry for my comments, they are in french.
var size = parseInt(readline());
var unitsPerPlayer = parseInt(readline());
var milieu;
var dir1;
var dir2;
var diffX;
var diffY;
var oldUnitX;
var oldUnitY;
// game loop
while (true) {
for (var i = 0; i < size; i++) {
var row = readline();
}
for (var i = 0; i < unitsPerPlayer; i++) {
var inputs = readline().split(' ');
var unitX = parseInt(inputs[0]);
var unitY = parseInt(inputs[1]);
}
for (var i = 0; i < unitsPerPlayer; i++) {
var inputs = readline().split(' ');
var otherX = parseInt(inputs[0]);
var otherY = parseInt(inputs[1]);
}
milieu=size/2;
oldUnitX=unitX;
oldUnitY=unitY;
if (unitX<milieu){
unitX+=1;
} else {
unitX-=1;
}//aller au centre pour X
if (unitY<milieu){
unitY+=1;
} else {
unitY-=1;
}//aller au centre pour Y
diffX=oldUnitX-unitX;//diffƩrence de direction
diffY=oldUnitY-unitY;//diffƩrence de direction
switch (diffX){
case -1:
switch (diffY){
case -1:
dir1="NW";
dir2="SE";
break;
case 0:
dir1="W";
dir2="E";
break;
case 1:
dir1="SW";
dir2="NE";
break;
}
break;
case 0:
switch (diffY){
case -1:
dir1="N";
dir2="S";
break;
case 1:
dir1="S";
dir2="N";
break;
}
break;
case 1:
switch (diffY){
case -1:
dir1="NE";
dir2="SW";
break;
case 0:
dir1="E";
dir2="W";
break;
case 1:
dir1="NW";
dir2="SE";
break;
}
break;
}//interpƩteur
var legalActions = parseInt(readline());
for (var i = 0; i < legalActions; i++) {
var inputs = readline().split(' ');
var atype = inputs[0];
var index = parseInt(inputs[1]);
dir1;
dir2;
}
// Write an action using print()
// To debug: printErr('Debug messages...');
print(atype+' '+index+' '+dir1+' '+dir2);
}
If someone can help me it would be nice please.
Thanks,
Fireye025
hey @Fireye025, sorry to answer to so late. Perhaps you can specify what issue you encounter exactly. Saying āit doesnāt workā does not help us. Is it the first multiplayer game you try?
Hello there.
This is not my first time programming, but first time on codingame.
Iām having a hard time while solving wondev woman stage 1, Iām pretty sure itās due to my lack of understanding of C++ and/or a memory leak.
After a few turns (15 to 30), my representation of the map gets filled with incoherent stuff, the move direction given by input (N/E/SW, etc) seems to be the empty string (as debug has shown), and sometimes (not always) it ends with really ugly messages of maybe 100 lines, filled with stuff like
*** Error in '/tmp/Answer': malloc(): memory corruption (fast): 0x000055555576fdd0 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7ffff69b5bcb]
or
at abort.c. function __GI_abort () on line 89 at libc_fatal.c. function __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff6aaadd0 "*** Error in '%s': %s: 0x%s ***\n") on line 175
Honestly I wouldnāt be surprised if I found by accident some secrets of codingameās internal architecture here.
Firstly, I canāt debug that issue because IT WORKS the first few turns. What can I do, std::cout
some more variables ? It will just (and has) display the expected values at first and still not work after.
Secondly, I know the information I gave here is not very useful, but I canāt show you where my error would be (I have no idea, it works after all !), and I canāt provide the whole code for you to scan, per the forum rules.
Hereās a taste of how my map is ācorruptedā after some time :
Map as expected (similar to the 18 previous turns) :
. . . 0 . . . . . 0 2 0 . . . 0 0 1 2 0 . 0 0 1 0 0 2 0 . 0 0 1 1 1 . . . 0 3 0 . . . . . 2 . . .
Next turn, getting a bit fucked up :
0 0 0 0 0 0 0 0 . 0 2 0 . . 0 0 0 1 2 0 . 0 0 1 0 0 2 0 0 0 0 0 0 0 0 0 . 0 3 0 . . 0 . . 2 . . 208
The turn after that, utter chaos :
-154277032 0 0 0 0 0 0 32767 . 0 2 0 . . -154277032 0 0 1 2 0 . 32767 0 1 0 0 2 0 0 0 0 0 0 0 0 0 . 0 3 0 . . 0 . . 2 . . 208
Since it fails only after some time, my guess is very little memory is given to me, and I leak it somehow (but I didnāt even use new
or pointers when that error first came up !) ; and it overrides some valuesā¦ or something.
Iām desperate for help, I canāt do anything, any suggestion would be appreciated. This is stupid, itās not even very complex, itās 200 lines of āRandom move unless you can win immediatelyā.
Also, is there a limit (in std::cerr
) on the number of displayed characters by the programmer, on codingame ?
PS : welp, I hoped rubber duck debugging would help, but Iām at the end of my post and itās still the same
Thanks to someone who private messaged me, this was solved.
It was partly because of an x/y inversion (ex : move 1;3 into 1;4 is possible, but itās 4;1 that has the height needed to win, not 1;4). Still not sure where was the problem, but I redid the whole map access, switched some variables and renamed.
The random factor was just āwhen I detect a winning moveā, not memory.
Once this was solved, still some errors displayed at the end, because I win, but keep calling cin because itās a while(1), which probably contains the last description of the game or something, and then EOF (look what I was pushing into the map)
row #0 =[MOVE&BUILD]
row #1 =[0]
row #2 =[SW]
row #3 =[N]
row #4 =[MOVE&BUILD]
So I used a wonGame boolean instead of while(1), now there are no error messages.
Forgive me father for I have cin
ed too much.
Hello,
I have a problem that sometimes, not always, appears in C# when itās running my solution. It does not seem to be a compilation problem neither, I think, a programmation problem. Hereās what the error output says:
- Assertion at gc.c:958, condition `is_ok (error)ā not met, function:mono_gc_init_finalizer_thread, Couldnāt create thread. Error 0x0 assembly: type: member:(null)
=================================================================
Native Crash Reporting
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
/proc/self/maps:
00400000-0084f000 r-xp 00000000 00:32 1153 /usr/bin/mono-sgen
00a4e000-00a56000 rāp 0044e000 00:32 1153 /usr/bin/mono-sgen
00a56000-00a5b000 rw-p 00456000 00:32 1153 /usr/bin/mono-sgen
00a5b000-00a72000 rw-p 00000000 00:00 0
011a8000-01240000 rw-p 00000000 00:00 0 [heap]
413b9000-413c9000 rwxp 00000000 00:00 0
ā¦
/usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f180ff7d000-7f180ff7e000 rāp 0063a000 00:32 1166 /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f180ff7e000-7f180ff7f000 rw-p 0063b000 00:32 1166 /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so
7f180ff7f000-7f180ffa8000 rw-p 00000000 00:00 0
7f180ffa8000-7f18103ff000 rāp 00000000 00:32 1163 /usr/lib/mono/4.5/mscorlib.dll
7f18103ff000-7f18113ff000 rw-p 00000000 00:00 0
7f18113ff000-7f1811400000 āp 00000000 00:00 0
7f1811400000-7f1812000000 rw-p 00000000 00:00 0
7f18120e8000-7f18121a0000 rw-p 00000000 00:00 0
7f18121a3000-7f18121d7000 rw-p 00000000 00:00 0
7f18121d7000-7f1812394000 rāp 00000000 00:32 3244 /usr/lib/mono/4.5/mcs.exe
7f1812394000-7f1812398000 rw-p 00000000 00:00 0
7f1812399000-7f181239a000 rw-p 00000000 00:00 0
7f181239a000-7f18123f9000 āp 00000000 00:00 0
7f18123f9000-7f18123fc000 rāp 00000000 00:32 1102 /lib/x86_64-linux-gnu/libnss_files-2.28.so
7f18123fc000-7f1812403000 r-xp 00003000 00:32 1102 /lib/x86_64-linux-gnu/libnss_files-2.28.so
=================================================================
Basic Fault Adddress Reporting
Memory around native instruction pointer (0x7f181272d8bb):0x7f181272d8ab d2 4c 89 ce bf 02 00 00 00 b8 0e 00 00 00 0f 05 .Lā¦
0x7f181272d8bb 48 8b 8c 24 08 01 00 00 64 48 33 0c 25 28 00 00 Hā¦$ā¦dH3.%(ā¦
0x7f181272d8cb 00 44 89 c0 75 1d 48 81 c4 10 01 00 00 5b c3 66 .Dā¦u.Hā¦[.f
0x7f181272d8db 0f 1f 44 00 00 48 8b 15 89 35 18 00 f7 d8 64 89 ā¦Dā¦Hā¦5ā¦d.
=================================================================
Native stacktrace:
0x521ff6 - /bin/mono : (null)
0x4b6211 - /bin/mono : (null)
0x7f18128e5730 - /lib/x86_64-linux-gnu/libpthread.so.0 : (null)
0x7f181272d8bb - /lib/x86_64-linux-gnu/libc.so.6 : gsignal
0x7f1812718535 - /lib/x86_64-linux-gnu/libc.so.6 : abort
0x714374 - /bin/mono : (null)
0x6fa6e1 - /bin/mono : (null)
0x71425b - /bin/mono : (null)
0x71481d - /bin/mono : monoeg_assertion_message
0x689a5f - /bin/mono : (null)
0x590f7b - /bin/mono : (null)
0x435c57 - /bin/mono : (null)
0x47f0c4 - /bin/mono : mono_main
0x42c17b - /bin/mono : (null)
0x7f181271a09b - /lib/x86_64-linux-gnu/libc.so.6 : __libc_start_main
0x42c8a3 - /bin/mono : (null)
=================================================================
Telemetry Dumper:
Entering thread summarizer pause from 0x7f18126f3780
Finished thread summarizer pause from 0x7f18126f3780.
Waiting for dumping threads to resume
Debug info from gdb:
And here it ends. I honestly donāt know what to do about this. A replay where it happens : https://www.codingame.com/replay/402904327
Is it my code somewhere or is this a bug ?
it might be related to https://www.codingame.com/forum/t/java-random-error-occurred-during-initialization-of-vm/120354/10
Can you still reproduce the issue?
I seem unable to reproduce the issue. Problem seems solved. Thank you !
Just a question: what happens if I try to build on a cell where there is an enemy that I did not see? Is the move cancelled (so that it is ? Is the move even included in the list of legal moves?
I did not see the answer in the rules in bronze league.
hi guys,
Iām trying to solve the Amazonial puzzle to practice AI algorithms, however it seems the puzzle description is incomplete and lacks many things. For example, there is no mention of the āACCEPT-DEFEATā output, which should be displayed when the player cannot move anymore. I had to browse the projectās code to find this.
Also, the puzzle is named āAmazonialā but the referee and some of the messages here state that itās āWondev Womanā. Are they the same puzzle?
So, all in all, I was wondering if this project is dead or should it be updated?
Thanks
This may be too late for you, but I also wondered the same question.
According to the referee code,
it looks
ć»the move will be executed and the build will be cancelled (If you can not see the build cell.)
ć»dealt as Invalid action and you lost your action right (If you can see the build cell.)
If the build is not an invalid action, this will be included in the list of legal moves probably for not detecting enemy by the list.
If I am wrong, please correct me.
I donāt understand the game in ligue bois. I have only one dir1 and one dir2 allowed, so what can I choose to do? Thereās only one code possible, and I suppose evrybody has about the same?
You may want to watch this introductory video (at least the beginning of it, if not the entire video). It may help you understand.