Colobot Forum - International Colobot Community
aim virus - Printable Version

+- Colobot Forum - International Colobot Community (https://colobot.info/forum)
+-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76)
+--- Forum: Colobot: Gold Edition Development (https://colobot.info/forum/forumdisplay.php?fid=62)
+---- Forum: Level Design & Story (https://colobot.info/forum/forumdisplay.php?fid=66)
+---- Thread: aim virus (/showthread.php?tid=930)



aim virus - DungeonLords - 06-06-2017

At this new level you should to kill all ants.

But from prev planet there are viruses in all Shooter bots.

When you try to use
aim(X,Y)
in fact
aim(X+XOffset,Y)

Houston says that XOffset is generated by https://en.wikipedia.org/wiki/Linear_congruential_generator

In every bot's program you can find gifts from virus: last six (or one, isn't important, but 4 numbers is need to broke generator at least) numbers of prev XOffset, the numbers go in a row (one by one). For example: 18 28 14 8 10 20
So you need decrypt Linear congruential generator or try to use aim without calibration.

Again please.
You use aim(X,Y)
in fact it will be aim(X+18,Y)
See gift from virus as comments: //18
analyze it.

use aim(X,Y)
in fact it will be aim(X+28,Y)
See gift from virus as comments: //18 28
analyze it.

use aim(X,Y)
in fact it will be aim(X+14,Y)
See gift from virus as comments: //18 28 14
analyze it.

use aim(X,Y)
in fact it will be aim(X+8,Y)
See gift from virus as comments: //18 28 14 8
analyze it.


P.S. crack decryption:
(a*18+c) mod m=28,
(a*28+c) mod m=14,
(a*14+c) mod m=8,
(a*8+c) mod m=10,
a>0,c>0,m>0, a,c,m are Integers

pascal code:
const Predicate=7660;//Integer.MaxValue;
      Xfirst = 0;

var a:=1;
m:=1;
c:=1;
x1:=1;
Xprev:=0;

var Ci,Mi,Ai,Xprev_i:Integer;
BEGIN
for Ci:=c to Predicate do
  for Mi:=m to Predicate do
    for Ai:=a to Predicate do  
      if (Ai*8+Ci) mod Mi = 10 then
        begin
            if (Ai*18+Ci) mod Mi = 28 then//if (4*Ai+Ci) mod Mi =3 then
              begin
                if (Ai*28+Ci) mod Mi = 14 then
                  begin
                      if (Ai*14+Ci) mod Mi =8 then//if (Ai*Xprev_i+Ci) mod Mi = 1 then writeln('of cause a='+Ai+' ,c='+Ci+' ,m= '+Mi+' ,XPrev='+XPrev_i);
                          writeln('a='+Ai+' ,c='+Ci+' ,m= '+Mi);
                  end;
              end;
        end;
END.

So I have got a,c,m and one of value. I can create any XOffset using XNew:=(a*Xold+c) mod m; After 20 it will be
XNew:=(5*20+2) mod 32=6

You can do not crack generator stupid. Use your ,mathematical knowledge.

aim() is just example. We can use Offset to any command: jet, turn, move, ...