精华内容
下载资源
问答
  • 好玩的代码

    2019-10-05 21:54:18
    local index = 1 local function outer(arg) local function iner() index = index + 1 local tb = {"a","b"} outer(tb) end i...
        local index = 1
        local function outer(arg)
            local function iner()
                index = index + 1
                local tb = {"a","b"}
                outer(tb)
            end
            if index < 10 then
                printInfo("index = %s", index)
                iner()
            else
                return
            end
            dump(arg, "arg")
        end
        outer("test")

     

    转载于:https://www.cnblogs.com/damowang/p/5013388.html

    展开全文
  • CentOS好玩的代码

    2021-01-09 15:43:59
    1.代码雨 1.下载cmatrix文件 [root@localhost ~]# wget https://jaist.dl.sourceforge.net/project/cmatrix/cmatrix/1.2a/cmatrix-1.2a.tar.gz --2018-07-17 15:06:03-- ...
  • 好玩的代码注释图 神兽保佑 代码无bug

        


    好玩的代码注释

    //
    //      ┏┛ ┻━━━━━┛ ┻┓
    //      ┃       ┃
    //      ┃   ━   ┃
    //      ┃ ┳┛   ┗┳ ┃
    //      ┃       ┃
    //      ┃   ┻   ┃
    //      ┃       ┃
    //      ┗━┓   ┏━━━┛
    //        ┃   ┃   神兽保佑
    //        ┃   ┃   代码无BUG!
    //        ┃   ┗━━━━━━━━━┓
    //        ┃           ┣┓
    //        ┃             ┏┛
    //        ┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
    //          ┃ ┫ ┫   ┃ ┫ ┫
    //          ┗━┻━┛   ┗━┻━┛
    
    
    
    //
    //                            _ooOoo_
    //                           o8888888o
    //                           88" . "88
    //                           (| -_- |)
    //                           O\  =  /O
    //                        ____/`---'\____
    //                      .'  \\|     |//  `.
    //                     /  \\|||  :  |||//  \
    //                    /  _||||| -:- |||||-  \
    //                    |   | \\\  -  /// |   |
    //                    | \_|  ''\---/''  |   |
    //                    \  .-\__  `-`  ___/-. /
    //                  ___`. .'  /--.--\  `. . __
    //               ."" '<  `.___\_<|>_/___.'  >'"".
    //              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
    //              \  \ `-.   \_ __\ /__ _/   .-` /  /
    //         ======`-.____`-.___\_____/___.-`____.-'======
    //                            `=---='
    //        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    //                      佛祖保佑       永无BUG
    
    
    <!--
                           ::
                          :;J7, :,                        ::;7:
                          ,ivYi, ,                       ;LLLFS:
                          :iv7Yi                       :7ri;j5PL
                         ,:ivYLvr                    ,ivrrirrY2X,
                         :;r@Wwz.7r:                :ivu@kexianli.
                        :iL7::,:::iiirii:ii;::::,,irvF7rvvLujL7ur
                       ri::,:,::i:iiiiiii:i:irrv177JX7rYXqZEkvv17
                    ;i:, , ::::iirrririi:i:::iiir2XXvii;L8OGJr71i
                  :,, ,,:   ,::ir@mingyi.irii:i:::j1jri7ZBOS7ivv,
                     ,::,    ::rv77iiiriii:iii:i::,rvLq@huhao.Li
                 ,,      ,, ,:ir7ir::,:::i;ir:::i:i::rSGGYri712:
               :::  ,v7r:: ::rrv77:, ,, ,:i7rrii:::::, ir7ri7Lri
              ,     2OBBOi,iiir;r::        ,irriiii::,, ,iv7Luur:
            ,,     i78MBBi,:,:::,:,  :7FSL: ,iriii:::i::,,:rLqXv::
            :      iuMMP: :,:::,:ii;2GY7OBB0viiii:i:iii:i:::iJqL;::
           ,     ::::i   ,,,,, ::LuBBu BBBBBErii:i:i:i:i:i:i:r77ii
          ,       :       , ,,:::rruBZ1MBBqi, :,,,:::,::::::iiriri:
         ,               ,,,,::::i:  @arqiao.       ,:,, ,:::ii;i7:
        :,       rjujLYLi   ,,:::::,:::::::::,,   ,:i,:,,,,,::i:iii
        ::      BBBBBBBBB0,    ,,::: , ,:::::: ,      ,,,, ,,:::::::
        i,  ,  ,8BMMBBBBBBi     ,,:,,     ,,, , ,   , , , :,::ii::i::
        :      iZMOMOMBBM2::::::::::,,,,     ,,,,,,:,,,::::i:irr:i:::,
        i   ,,:;u0MBMOG1L:::i::::::  ,,,::,   ,,, ::::::i:i:iirii:i:i:
        :    ,iuUuuXUkFu7i:iii:i:::, :,:,: ::::::::i:i:::::iirr7iiri::
        :     :rk@Yizero.i:::::, ,:ii:::::::i:::::i::,::::iirrriiiri::,
         :      5BMBBBBBBSr:,::rv2kuii:::iii::,:i:,, , ,,:,:i@petermu.,
              , :r50EZ8MBBBBGOBBBZP7::::i::,:::::,: :,:,::i;rrririiii::
                  :jujYY7LS0ujJL7r::,::i::,::::::::::::::iirirrrrrrr:ii:
               ,:  :@kevensun.:,:,,,::::i:i:::::,,::::::iir;ii;7v77;ii;i,
               ,,,     ,,:,::::::i:iiiii:i::::,, ::::iiiir@xingjief.r;7:i,
            , , ,,,:,,::::::::iiiiiiiiii:,:,:::::::::iiir;ri7vL77rrirri::
             :,, , ::::::::i:::i:::i:i::,,,,,:,::i:i:::iir;@Secbone.ii:::
    
    --
    
    
    


    /**
     * 頂頂頂頂頂頂頂頂頂 頂頂頂頂頂頂頂頂頂
     * 頂頂頂頂頂頂頂     頂頂     
     *    頂頂   頂頂頂頂頂頂頂頂頂頂頂
     *    頂頂   頂頂頂頂頂頂頂頂頂頂頂
     *    頂頂   頂頂       頂頂
     *    頂頂   頂頂  頂頂頂  頂頂
     *    頂頂   頂頂  頂頂頂  頂頂
     *    頂頂   頂頂  頂頂頂  頂頂
     *    頂頂   頂頂  頂頂頂  頂頂
     *    頂頂       頂頂頂 
     *    頂頂      頂頂 頂頂 頂頂
     *  頂頂頂頂   頂頂頂頂頂 頂頂頂頂頂
     *  頂頂頂頂   頂頂頂頂   頂頂頂頂
     */


    展开全文
  • [python]代码库import pygamefrom random import randintimport mathprint("按下空格建发射子弹")pygame.init()screen = pygame.display.set_mode((800, 600))pygame.display.set_caption("飞机大战&...

    [python]代码库import pygame

    from random import randint

    import math

    print("按下空格建发射子弹")

    pygame.init()

    screen = pygame.display.set_mode((800, 600))

    pygame.display.set_caption("飞机大战")

    icon = pygame.image.load('ufo.png')

    pygame.display.set_icon(icon)

    bgimg = pygame.image.load('bg.png')

    enemyimg = pygame.image.load('enemy.png')

    pygame.mixer.music.load('bg.wav')

    pygame.mixer.music.play(-1)

    bomb_sound = pygame.mixer.Sound('exp.wav')

    playerimg = pygame.image.load('player.png')

    playerX = 400

    playerY = 500

    playStep = 0

    score = 0

    font = pygame.font.Font('freesansbold.ttf', 35)

    def show_score():

    text = f"score:{score}"

    score_render = font.render(text, True, (0, 200, 255))

    screen.blit(score_render, (10, 10))

    is_over = False

    over_font = pygame.font.Font('freesansbold.ttf', 64)

    def check_is_over():

    if is_over:

    text = "Game Over"

    render = over_font.render(text, True, (255, 50, 10))

    screen.blit(render, (230, 250))

    number_of_enemies = 10

    class Enemy():

    def __init__(self):

    self.img = pygame.image.load('enemy.png')

    self.x = randint(100, 600)

    self.y = randint(50, 250)

    self.step = randint(2, 5)

    def reset(self):

    self.x = randint(100, 600)

    self.y = randint(50, 250)

    Enemies = []

    for i in range(number_of_enemies):

    Enemies.append(Enemy())

    def show_enemy():

    global is_over

    for e in Enemies:

    screen.blit(e.img, (e.x, e.y))

    e.x += e.step

    if (e.x > 736 or e.x < 0):

    e.step *= -1

    e.y += 40

    if e.y > 450:

    is_over = True

    print("游戏结束啦!")

    Enemies.clear()

    def distance(bx, by, ex, ey):

    a = bx - ex

    b = by - ey

    return math.sqrt(a*a + b*b)

    bullets = []

    class Bullet():

    def __init__(self):

    self.img = pygame.image.load('bullet.png')

    self.x = playerX

    self.y = playerY + 10

    self.step = 10

    def hit(self):

    global score

    for e in Enemies:

    if (distance(self.x, self.y, e.x, e.y) < 40):

    bomb_sound.play()

    bullets.remove(self)

    e.reset()

    score += 1

    def show_bullet():

    for bull in bullets:

    screen.blit(bull.img, (bull.x, bull.y))

    bull.hit()

    bull.y -= bull.step

    if bull.y < 0:

    bullets.remove(bull)

    def distance_two(bx, by, ex, ey):

    a = bx - ex

    b = by - ey

    return math.sqrt(a*a + b*b)

    bullets_two = []

    class Bullet_two():

    def __init__(self):

    self.img = pygame.image.load('bullet.png')

    self.x = playerX + 30

    self.y = playerY + 10

    self.step = 10

    def hit_two(self):

    for d in Enemies:

    if (distance_two(self.x, self.y, d.x, d.y) < 40):

    bomb_sound.play()

    bullets_two.remove(self)

    d.reset()

    def show_bullet_two():

    for b in bullets_two:

    screen.blit(b.img, (b.x, b.y))

    b.hit_two()

    b.y -= b.step

    if b.y < 0:

    bullets_two.remove(b)

    def move_player():

    global playerX

    playerX += playStep

    while playerX > 736:

    playerX -= 6

    while playerX < 0:

    playerX +=6

    running = True

    while running:

    screen.blit(bgimg, (0, 0))

    show_score()

    for event in pygame.event.get():

    if event.type == pygame.QUIT:

    running = False

    if event.type == pygame.KEYDOWN:

    if event.key == pygame.K_RIGHT:

    playStep = 6

    elif event.key == pygame.K_LEFT:

    playStep = -6

    elif event.key == pygame.K_SPACE:

    print("发射子弹....")

    bullets.append(Bullet())

    bullets_two.append(Bullet_two())

    if event.type == pygame.KEYUP:

    playStep = 0

    screen.blit(playerimg, (playerX, playerY))

    move_player()

    show_bullet()

    show_bullet_two()

    show_enemy()

    check_is_over()

    pygame.display.update()

    [源代码打包下载]

    rar_icon.giffaijidazan.zip(50积分)[26 次下载]

    201903221632.jpg

    展开全文
  • 好玩的代码读你的心

    千次阅读 2013-12-30 09:46:20
    好玩的代码读你的心,根据你选的数进行计算得出你心中的字符 import java.util.Scanner; public class DXS { public static void main(String[] args) { sysout(); } static String[] str = new ...

    好玩的代码读你的心,根据你选的数进行计算得出你心中的字符



    import java.util.Scanner;
    
    
    public class DXS {
    	public static void main(String[] args) {
    		
    		sysout();
    	}
    	
    	static String[] str = new String[] { "!", "@", "#", "$", "%", "^", "&", "*", "(",
    			")","A","B","C", "D","E","F","G","H","I","J","K","M","L","N" };
        static int f = 0;
        
        public  static void sysout()
        {
        	  int i=0;
              int s=0;
    			System.out.println("----------------------------"
    					+ "-----------------------------------");
              for (int m = 0; m < 10; m++ )
              {
                  for (int k = 0; k < 10; k++)
                  {
                      if (i == 9)
                      {
                          f = s;
                      }
                      s = (int)(Math.random()*str.length);
                      if(i<90)
                      {
    	                  if (i % 9 == 0)
    	                      s = f;
                      }
                      System.out.print(i+":"+str[s]+"\t");
                      i++;
                  }
                  System.out.println("\n");
              }
              System.out.println("----------------------------"
              		+ "-----------------------------------");
              System.out.println("(必须是两位数的!)选好了吗?选好了后算"
              		+ "算你选的数:算法:XY-(X+Y)然后找到对应的字符记住。(选好了请输入Y否则将退出本程序):");
              Scanner sc=new Scanner(System.in);
              String a=sc.next();
              System.out.println("看看我猜的对么:"+str[f]);
              
        }
    }

    结果:


    按要求输入求得结果


    个人观点:

    玩了点数字的小把戏







     “|”两边的数,左边依次是10—99,按照上述方法计算的结果,右边是他们的个位数。
    这个方法就是让下标识9,18,27,36,……,81的字符相同,直接输出就ok了,
    骗人的小把戏。











    展开全文
  • 好玩的代码注释

    2019-08-21 19:35:28
    看到了一些比较好玩的注释,分享保存一下。 来源 | https://github.com/Blankj/awesome-comment 作者 | Blankj /*** ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬...
  • 一些好玩的代码

    千次阅读 2019-09-23 23:26:02
     将以下代码复制到地址框,回车。有些浏览器会把"javaScript"过滤掉,可手动添加"javaScript" javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; var DI= ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,731
精华内容 1,092
关键字:

好玩的代码