Because the male protagonist in the film did not show any frowning stares or shout the name of his nirvana in a loud voice before "foreseeing", it can be considered that there is a process in the male lead's mind to deal with "foreseeing", and he does not need to do it. drive.
Because a certain future of change affects the whole process, after the change, it is necessary to "predict" on the basis of the change. Once the irreversible "DeadEnd" is encountered, the prediction will reset to zero.
Here is the code, where undefined functions are provided by God.
Untested~~
ARRAY LINE=NULL; //This is a two-minute security action queue
Next(NOW,120);
LINE;
FUNCTION String NEXT(NOW,SPAN)
{
Int ISDeadEnd;
//Because the protagonist can only foresee at first The content of 2 minutes, so the loop time is 120 seconds.
For (INT i=0;i{
DefaultActvalue=actvalue;//The default behavior of this second
//The dangerous value after i seconds is judged, if there is danger, return true Loop Action Directive Safe
WHILE(ISDangours(i, GetAction(Actvalue)))
{
IF(ISDangours(I, GetAction(Actvalue))==”DeadEnd”)
{
IsDeadEnd=1;
Continue;
}
Actvalue=GetReActValue();
}
IF(IsDeadEnd!=1)
{
IF(DefaultActvalue!=Actvalue)
{
NEXT(NOW+I,SPAN-I); //When the security of a certain second is found When the behavior is different from the default behavior
}
Else
{
LINE.ADD(Actvalue); //If there is no danger, put the safe behavior if the behavior queue
I++;
}
}
ELSE
{
LINE.DEL(ALL);
I=0;
}
}
SetTimeOut(Next( ), 120); // call again after 2 minutes
}
View more about Next reviews