一个for循环实现飞机大战

Published on
/
/趣玩前端
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>空间入侵者</title>
  </head>
  <body>
    <script>
      for (
        p = 389,
          L = l = m = t = 0,
          c = ' _ ',
          onkeydown = function (e) {
            39 == (k = e.which) ? p++ : 37 == k ? p-- : !l & (l = p);
          },
          setInterval(
            '_="<pre>";l&(l-=20)<0&&(l=0);m=(m+=20)>p?b[+new Date%6]:m;for(i=0;i<400;i++){if(i%20==0)_+="\\n";if(~b[n="indexOf"](l))b.splice(b[n](l),1),L+=5,l=0;if(~b[n](p)||p==m)p=n,b=[],c="xxx";_+=i==p?"oIo":~b[n](i)?".#.":i==m&&m?" * ":i==l&&l?" | ":c}document.body.innerHTML=_+="\\nP "+L;t+=o;for(i in b)b[i]+=t%5e3==0?20:t%2e3==0?1:t%1e3==0&&-1',
            (o = 50)
          ),
          b = [],
          j = 2;
        136 > j;
        j += 14 == j || 94 == j ? 29 : 55 == j ? 27 : 2
      )
        b.push(j);
    </script>
  </body>
</html>