来秀一下你屎一般的代码... (来源豆瓣线上活动)

高阳Sunny
  • 5.3k

豆瓣这个活动感觉很火,也蛮有意思的,就摘过来,大家友情参与,哈哈~
活动地址:http://www.douban.com/online/10917653...
活动描述:

我们都是程序员,我们都是大天才…… 
可是我们每天却不得不写着屎一样的代码…… 
TOT 
来秀秀你屎一样的代码吧
注释也好,猥琐代码也罢,让我们知道身为一名屎程序员,每天都在抠着什么样的腚吧!!

请输入图片描述

SF语:你刚入道的时候是否也写过屎一般的代码,或者现在迫不得已写这屎一般的代码,赶紧拿出来秀秀~~
画外音:祝SF所有的程序员写出一手优美的代码,搞出给力的产品来~

评论
阅读 9k
10 个回答

为了防止人家随便修改程序 我的变量名一般这么取

main()
{
	int oo00O0oo=2;
	int oo00OOoo=3;
	int oo0O00oo=4;
	int oo0O0Ooo=5;
	int oo0OO0oo=6;
	int oo0OOOoo=7;
	int ooO000oo=8;
	int ooO00Ooo=9;
	pinMode(oo00O0oo,OUTPUT);
	pinMode(oo00OOoo,OUTPUT);
	pinMode(oo0O00oo,OUTPUT);
	pinMode(oo0O0Ooo,OUTPUT);
	pinMode(oo0OO0oo,OUTPUT);
	pinMode(oo0OOOoo,OUTPUT);
	pinMode(ooO000oo,OUTPUT);
	pinMode(ooO00Ooo,OUTPUT);
	while(1){
		digitalWrite(ooO00Ooo, LOW); digitalWrite(oo00O0oo, HIGH); delay(500);
		digitalWrite(oo00O0oo, LOW); digitalWrite(oo00OOoo, HIGH); delay(500);
		digitalWrite(oo00OOoo, LOW); digitalWrite(oo0O00oo, HIGH); delay(500);
		digitalWrite(oo0O00oo, LOW); digitalWrite(oo0O0Ooo, HIGH); delay(500);
		digitalWrite(oo0O0Ooo, LOW); digitalWrite(oo0OO0oo, HIGH); delay(500);
		digitalWrite(oo0OO0oo, LOW); digitalWrite(oo0OOOoo, HIGH); delay(500);
		digitalWrite(oo0OOOoo, LOW); digitalWrite(ooO000oo, HIGH); delay(500);
		digitalWrite(ooO000oo, LOW); digitalWrite(ooO00Ooo, HIGH); delay(500);
	}
}

这是我在typecho的js里写的代码,应该是我大学毕业时期的作品。我居然还在每个变量前面加了个下划线。。。tmd这是跟谁学的

代码截图

有个人为了生成一段圆弧用了120个贝塞尔曲线拼接了起来
绝对不是我写的

+(UIBezierPath *)circlePath:(CGFloat)radius centerX:(CGFloat)a centerY:(CGFloat)b{

    UIBezierPath * path = [UIBezierPath bezierPath];
    
    for (int i = 0; i<=357; i+=3) {
        CGPoint startPoint = CGPointMake(a+sinf(i*M_PI/180)*radius, b+cosf(i*M_PI/180)*radius);
        CGPoint endPoint = CGPointMake(a+sinf((i+3)*M_PI/180)*radius, b+cosf((i+3)*M_PI/180)*radius);
        CGPoint conPoint1 = CGPointMake(a+sinf((i+1)*M_PI/180)*radius, b+cosf((i+1)*M_PI/180)*radius);
        CGPoint conPoint2 = CGPointMake(a+sinf((i+2)*M_PI/180)*radius, b+cosf((i+2)*M_PI/180)*radius);
        
        [path moveToPoint:startPoint];
        [path addCurveToPoint:endPoint controlPoint1:conPoint1 controlPoint2:conPoint2];
    }
    
    return path;
}

大四时候写的代码。。。我就纳闷了,难道我那时候不知道换行是什么吗?
大便一样的代码

tension
  • 2
新手上路,请多包涵

我写的。。。
请输入图片描述

我也不知道不换行的毛病跟谁学的
请输入图片描述

小鼬
  • 2
新手上路,请多包涵

这辈子都不想写爬虫了...
这辈子都不想写爬虫了...

blue弄影儿
  • 1
新手上路,请多包涵

前两天刚写的:

/*
 * run_tank.c
 *
 * Copyright 2012  <blueyinger@ubuntu>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define TANK_POS 46


static int index = 0;        /*tank 当前位置下标*/
/**
 *空格初始化
 *需要提前在内存中构造好空格,使用的时候随机访问,以减少画面迟缓残留或抖动
 */
char *space[TANK_POS] = {"                                             ",
                	 "                                            ",
		         "                                           ",
		         "                                          ",
		         "                                         ",
		         "                                        ",
		         "                                       ",
		         "                                      ",
		         "                                     ",
		         "                                    ",
		         "                                   ",
		         "                                  ",
		         "                                 ",
		         "                                ",
		         "                               ",
		         "                              ",
		         "                             ",
		         "                            ",
		         "                           ",
		         "                          ",
		         "                         ",
		         "                        ",
		         "                       ",
		         "                      ",
		         "                     ",
		         "                    ",
		         "                   ",
		         "                  ",
		         "                 ",
		         "                ",
		         "               ",
		         "              ",
		         "             ",
		         "            ",
		         "           ",
		         "          ",
		         "         ",
		         "        ",
		         "       ",
		         "      ",
		         "     ",
		         "    ",
		         "   ",
		         "  ",
		         " ",
		         "",
		        };



/**
 *tank:使用*描绘
 */
void tank()
{

    printf("%s*****************                \n", space[index]);

    printf("%s         **************          \n", space[index]);

    printf("%s        *****************        \n", space[index]);

    printf("%s    **************************   \n", space[index]);

    printf("%s******** * ******** * ***********\n", space[index]);

    printf("%s*******    ********   ***********\n", space[index]);


}

void drive()
{

    while(++index < TANK_POS)
    {

        system("clear");
        tank();
        usleep(50000);

    }
}

int finalize() {
    system("clear");
    return 0;
}

int main()
{
    drive();
    sleep(2);
    finalize();
    printf("Bye-bye!\n");
    return 0;
}
陨丶c
  • 3
新手上路,请多包涵
public Date getNextDay() {
    try {
        Thread.sleep(24 * 3600 * 1000L);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return new Date();
}
撰写回答

登录后参与交流、获取后续更新提醒

宣传栏