Talk:Smoke/Code
From old wiki
iiley, two questions:
1) why do you compare waves that are separated by '7' in your 'wavelist'? Is this the result of an empirical test?
2) how are you certain that the waves you compare with also have hit?
Thanks! --Loki
for questions 1: Yes it is a empirical test, but i still have a reason, a bot want to accclerate to max velocity must need 8 ticks, In old version Smoke, I use 8, but then i use 7 for careful pattern(I think less than 8 should be alright).
for questions 2: Sorry that i don't understand you from my English, It's a long complex sentence, can you split the sentence for me ~:} Oh, just so sorry.
-- iiley
For questions 2: I am guessing are you talking about this:
//is a hitted wave if ((wave = (MicroWave) waves.get(i)).startPosition.x < 10) {
-- iiley
Hi iiley, please don't apologise for your English, i think it's a problem of my english! In my second question i was referring to this part
comVal += ((MicroWave) waves.get(size - j)).compareValue .distanceSq(((MicroWave) waves.get(i - j)).compareValue) / (div = div * 2 + 1);
You compare wave(i) with other waves(j). How do you know these waves(j) have hit the opponent? I think if they have not hit, your calculation of the best value goes wrong. Because the values of compareValue for these waves that have not hit are meaningless as they still contain the initial values. Or do i understand this part wrong? --Loki
comVal is incremented inside this loop:
for (int i = Math.max(71, size - 4500); i < size; i++) {
In a 800x600 battle field any wave has hit after 71 ticks.
-- PEZ
PEZ was right, and i don't care whether waves(j) have hit the opponent, i just care waves(i). Do you know my meanning? I just need waves(j)'s compareValue, and compareValue is not relative to whether it have hit opponent, but startPosition does.(startPosition.x was the hit angle when the wave have hit opponent) -- iiley
ok, so the 71 is optimised/fixed for standard RR battles. As 0 <= j <= 70, i-j are always 'older' waves which must have past the opponent. I will rewrite this code in Mega bot size ;) without all the reuse of variables, just for my own understanding. --Loki