☕ A caffeine-driven developer.
Coffee Mode
const coder = {
caffeine: 0,
refill() {
this.caffeine++
console.log(`☕ 咖啡因水平增加到: ${this.caffeine}`)
return this
},
async code() {
const states = [
{ emoji: '😴', output: '无法集中注意力...' },
{ emoji: '👨💻', output: '专注模式,代码流畅' },
{ emoji: '⚡', output: '灵感爆发,代码如行云流水!' },
{ emoji: '🚀', output: '超神状态,一小时抵一天!' },
{ emoji: '🤯', output: '咖啡因过载,思维混乱...' },
]
// 咖啡因过量警告
if (this.caffeine > 3) console.log('⚠️ 警告:咖啡因摄入过量!')
const level = Math.min(states.length - 1, this.caffeine)
console.log(`🧠 当前咖啡因等级: ${level}`)
// 咖啡因延迟效应:咖啡因水平越高,响应越快
await new Promise(r => setTimeout(r, this.caffeine ? 500 / this.caffeine : 2000))
this.caffeine = Math.max(0, this.caffeine - 1)
console.log(`⏬ 咖啡因消耗后水平: ${this.caffeine}`)
const result = `${states[level].emoji} ${states[level].output}`
console.log(`📝 输出结果: ${result}`)
return result
},
sleep() {
console.log('💤 休息中...')
this.caffeine = 0
return this
},
}
// 示例
await coder.code() // 无咖啡
await coder.refill().code() // 一杯咖啡
await coder.refill().refill().code() // 两杯咖啡
await coder.refill().refill().refill().code() // 三杯咖啡
await coder.sleep() // 休息