程序员编写出了“灭霸”命令:一半的“对象”在恐慌!

高智商技术宅李一一,联合政府紧急技术观察员、青年科学家。

 

在键盘上飞速敲打的双手和专注的表情是不是觉得特别像平常敲代码的你(年轻的时候)。

 

在抢修地球发动机失败后,正是他凭借专业知识,在全人类绝望的时刻提出“点燃木星计划”,带领整个救援小组实施计划最终成功摆脱地球引力...

 

在现实中,也有程序员编写出了《流浪地球》“春节十二响”的C语言源码,并上传到了GitHub中

春节十二响 源码

// File: twelve_biubiu.c
// Permission: CN-2082-2
// Author: Li.YiYi
// Dept: PE-362, UG
// Origin: TI-352132
// 春节十二响 biu biu biu!

#env "planet_engine"

int init() {
    set_engine_number_mask(ENGINE_ALL);
    set_funeral_level(FUNERAL_FULL);
    // 允许误差10秒以内
    if (unix_time() < make_unix_time(2082, 1, 28, 23, 59, 60-10)) return ERR_ENGIN_ENV;
    return engine_check_init(); // after compile and before real run
}
int main() {
    set_curve(CURVE_NATURAL); // 自然曲线耗费燃料最少
    for (int i :range(0, 12, 1)) {
        engine_start();
        wait_engine(ENGINE_STATE_CHAGNE);
        sleep(2000);
        engin_stop();
        wait_engine(ENGINE_STATE_CHAGNE);
        sleep(4000); // 这个时长在模拟器里听起来更像心跳
    }
    return 0;
}
int final() {
    engine_ensure_shutdown();
}

代码已经写出来了,接下来就差“行星发动机”运行环境以及对应的头文件了。

 

故事告一段落,新的篇章也将开启。

 

《复仇者联盟4:终局之战》已经在国内创造了一系列纪录:

预售用时10小时成功破亿,创造了中国影史最快破亿纪录;

映前总预售7.74亿,创造了中国影史映前总预售新纪录,也是中国影史首次单片预售破5亿;

首映日预售1.61亿,上映前一日超越了《复联3》,创造了进口片首映日预售新纪录;

零点场1.88亿票房,将《速8》此前保持的零点场纪录提升了1.26亿,放映场次3.93万,观影人次325.5万,均为中国影史零点场新纪录!

这也是中国影史首次零点场票房破1亿。

IMAX预售1.4亿+,创造了中国影史的IMAX预售纪录外,《复联4》也刷新了IMAX中国开画日票房新纪录。

 

 

已经陪伴很多人十年的漫威又开启了复联4,剧情承接上一部,在灭霸打了一个响指后,全宇宙的一半“对象”随机消失...

 

灭霸程序员是如何打响响指的呢?

 

说明:

灭霸命令可以随机地删除你一半文件

不论是在家里还是其他地方,请不要轻易使用。

这将是一场“真实的战争”,你拿到的是一把真正的“枪”,请务必明智地使用它…

“story.md” 等待输入你的故事...

 

 

 

## 灭霸命令

##灭霸第一步:将当前路径中的文件数除以2。

##灭霸第一步:获取当前路径中的所有文件,并在一行中打印。

##灭霸第三步:将第二步输出的一半随机转换为标准输入。

##灭霸第四步:显示终端中的一半文件。

灭霸源码

[CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = 'High')]
Param
(
    [string]$Path = '.'
)
Begin
{
    $local:hadDisabled = $PSDefaultParameterValues.ContainsKey('Disabled')
    $local:disabledValue = $PSDefaultParameterValues['Disabled']
    $PSDefaultParameterValues['Disabled'] = $True
    $local:hasWhatIf = $PSBoundParameters.ContainsKey('WhatIf')
    $local:hasConfirm = $PSBoundParameters.ContainsKey('Confirm')
    # Resolve WhatIf and Confirm.
    If (-not $local:hasWhatIf -and -not $local:hasConfirm)
    {
        $WhatIf = $True
        $local:WhatIfPreference = $True
        $Confirm = $True
        $local:ConfirmPreference = 'Low'
        Write-Verbose 'WhatIf and Confirm are not specified. Both default to $True.'
    }
    If ($local:hasWhatIf -and -not $local:hasConfirm)
    {
        $WhatIf = $PSBoundParameters['WhatIf']
        $Confirm = $True
        $local:ConfirmPreference = 'Low'
        Write-Verbose 'WhatIf is specified while Confirm is not. Confirm defaults to $True.'
    }
    If (-not $local:hasWhatIf -and $local:hasConfirm)
    {
        $WhatIf = $WhatIfPreference
        $Confirm = $PSBoundParameters['Confirm']
        Write-Verbose 'Confirm is specified while WhatIf is not. WhatIf defaults to $WhatIfPreference.'
    }
    If ($local:hasWhatIf -and $local:hasConfirm)
    {
        $WhatIf = $PSBoundParameters['WhatIf']
        $Confirm = $PSBoundParameters['Confirm']
        Write-Verbose 'Both WhatIf and Confirm are specified.'
    }
}
Process
{
    $local:resolvedPath = Resolve-Path -LiteralPath $Path
    $local:randomSource = [System.Random]::new()
    If ($local:resolvedPath -eq $null)
    {
        Write-Error 'Thanos failed to come to the site.' -RecommendedAction 'Do not invoke Thanos.'
        Return
    }
    Switch -Regex -CaseSensitive ($local:resolvedPath.Provider.Name)
    {
        'FileSystem' {
            $local:resolvedPath | Get-ChildItem -Recurse -Force -File |
                Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                Remove-Item -Force -WhatIf:$WhatIf -Confirm:$Confirm
        }
        'Registry' {
            $local:resolvedPath | Get-ChildItem -Recurse -Force -PipelineVariable regKey |
                ForEach-Object { $regKey.Property |
                    Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                    ForEach-Object { $regKey |
                        Remove-ItemProperty -Name $_ -WhatIf:$WhatIf -Confirm:$Confirm }
                }
        }
        'Certificate' {
            $local:resolvedPath |
                Get-ChildItem -Recurse -Force |
                Where-Object { $_ -is [X509Certificate] } |
                Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                Remove-Item -Force -WhatIf:$WhatIf -Confirm:$Confirm
        }
        'Variable|Function|Alias' {
            $local:resolvedPath | Get-ChildItem -Force |
                Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                Remove-Item -Force -WhatIf:$WhatIf -Confirm:$Confirm
        }
        'Environment' {
            $local:resolvedPath | Get-ChildItem -Force |
                Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                ForEach-Object {
                    If ($PSCmdlet.ShouldProcess($_.Name, 'Remove environment variable from Machine, User and Process'))
                    {
                        [System.Environment]::SetEnvironmentVariable($_.Name, $null, 'Machine')
                        [System.Environment]::SetEnvironmentVariable($_.Name, $null, 'User')
                        [System.Environment]::SetEnvironmentVariable($_.Name, $null, 'Process')
                    }
                }
        }
        Default
        {
            $local:resolvedPath | Get-ChildItem -Recurse -Force |
                Where-Object { $_ | Test-Path -PathType Leaf } |
                Where-Object { $randomSource.NextDouble() -lt 0.5 } |
                Remove-Item -Force -WhatIf:$WhatIf -Confirm:$Confirm
        }
    }
}
End
{
    If ($local:hadDisabled)
    {
        $PSDefaultParameterValues['Disabled'] = $local:disabledValue
    }
    Else
    {
        $PSDefaultParameterValues.Remove('Disabled')
    }
}

灭霸源码:https://github.com/yizhiamumu/Thanos.git

 

 

今天,你复联4了吗?

公众号【一只阿木木】:talk is easy, show me the code

猜你喜欢

转载自www.cnblogs.com/yizhiamumu/p/10773919.html
今日推荐