Apollo-11: 汇编不好理解,我花了八年把他改成了高级语言的写法,不会汇编的或者想看高级语言版本的可以看过来

Created on 19 Jul 2019  ·  5Comments  ·  Source: chrislgarry/Apollo-11

class SaturnFive {
    constructor(){
        this.countDown=0;
        this.speed=0;
        this.distance=384403.9;
    }
    ready(){
        console.log("进入倒计时");
        this.countDown=10;
        let timer = setInterval(()=> {
            console.log(this.countDown--);
            if(this.countDown===0){
                this.fire();
                clearInterval(timer);
            }
        },1000)
    }
    fire(){
        console.log("点火");
        this.speed=100000;
        const time = this.distance/this.speed;
        console.log(time+"秒后到达");
        setTimeout(()=>{
            console.log("到达");
        },time*1000)
    }
}
class Apollo11 {
    constructor(){
        this.money=0;
        this.rocket=null;
        console.log("Apollo11立项");
    }
    crowdFunding(){
        this.money+=1000000000000;
        console.log("众筹获得1000000000000");
    }
    buildRocket(){
        if(this.money<1000000000000){
            throw new Error("穷碧,先去筹钱")
        }
        this.money-=1000000000000;
        this.rocket= new SaturnFive();
        console.log("成功建造出土星五号")
    }
}
const apollo11 =new Apollo11();
apollo11.crowdFunding();
apollo11.buildRocket();
apollo11.rocket.ready();
Humour

Most helpful comment

陈智炜我知道 你在看 别看了 回去改bug

All 5 comments

该说你是大佬呢?
还是沙雕呢……

该说你是大佬呢?
还是沙雕呢……

合并成大雕倒是符合我

image
(手动滑稽)

陈智炜我知道 你在看 别看了 回去改bug

You "dou ji ling" is very well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lyda picture lyda  ·  7Comments

lurch picture lurch  ·  5Comments

cjmielke picture cjmielke  ·  3Comments

yeukhon picture yeukhon  ·  5Comments

MaskEgo picture MaskEgo  ·  3Comments