猫史档案馆


大AI时代

大AI时代

Lv.1

获赞:77收藏:8浏览:771作品收藏:17
回复帖子评论
上一页1 页 / 共 2下一页

【手机编程】口袋里的编程神器,随时随地创造世界! 中回复

emotion_雷电猴_疑问

2020-05-13T17:23:18 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_imagecenter_image

2020-07-19T15:22:13 点赞:0

收徒弟,(计术好一点的) 中回复

ní  mēn  huì  dǎ  pīn  yīn  mā?

你    们     会    打  拼    音    吗?

2020-07-22T09:05:40 点赞:0

你们考得怎么样? 中回复

语文:96

数学:99

英语:99.5

科学:92

考的还好

2020-07-22T09:09:39 点赞:0

【找徒弟】 中回复

我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我 我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我

2020-07-22T09:11:41 点赞:0

重返喵,你会干什么? 中回复

ē

2020-07-22T10:34:05 点赞:0

【公告】申诉流程指南 中回复

center_image

我只是发了一个表情包而已,我怎么就被举报了!?

2020-07-24T09:25:23 点赞:0

【暑期活动】社区史上周边奖励最多的小说、表情包、绘画活动!!! 中回复

center_image

                            我已经投稿好了

2020-07-24T09:42:24 点赞:0

一起来BOX 3制作“喵荣耀”! 中回复

重新再发一个网址:

https://box3create.codemao.cn/games/79喵84302557c06dbaed?p=9qiry2yvFDwZW4KT6PdPkpr%2F8Row%2Ftg0og8apVSNauA%2BmCuyTBLgzmiYDmnInogYzkuJo%3D

2020-08-21T13:06:35 点赞:0

【暑期活动】云夏令营已结束,签到获奖名单已公布 中回复

签到831

2020-08-31T15:26:36 点赞:0

编程猫的编辑器介绍视频 中回复

我自己制作的视频

 

2020-09-01T19:34:47 点赞:0

来制作【box3】 中回复

https://box3create.codemao.cn/games/21f150c990bf994cbdb0?p=Rj0%2FlLYLHMYgxlaKvANnnowa5xvMUkiW4X6FL%2FJhJ3A6f7v喵GLgnmlrDogYzkvY0%3D

 

2020-09-05T16:36:48 点赞:0

来制作【box3】 中回复

已停止公开

 

2020-09-05T18:01:41 点赞:0

你是认真的吗? 中回复

其实代码是:

world.onChat(({ entity, message }) => {
    // 当玩家发送‘变大’文字的时候放大2倍,当玩家发送‘变小’文字的时候缩小2倍
    if (entity && entity.isPlayer) {
        if (message === '变大') {
            entity.player.scale *= 2;
        } else if (message === '变小') {
            entity.player.scale /= 2;
        }
        world.say('adjusting scale of ' + entity.player.name + ' to ' + entity.player.scale);
    }
})

2020-09-11T15:54:04 点赞:0

哦耶!~太好了! 中回复

emotion_编程猫_点赞

2020-09-11T16:15:50 点赞:0

【编程猫健康护航计划】简单防疫作品制作教程,快来看看~ 中回复

emotion_编程猫_加油

2020-09-15T17:57:25 点赞:0

俄罗斯方块? 中回复

import pygame
import random
colors = [
    (0, 0, 0),
    (120, 37, 179),
    (100, 179, 179),
    (80, 34, 22),
    (80, 134, 22),
    (180, 34, 22),
    (180, 34, 122),
]


class Figure:
    x = 0
    y = 0
    figures = [
        [[1, 5, 9, 13], [4, 5, 6, 7]],
        [[1, 2, 5, 9], [0, 4, 5, 6], [1, 5, 9, 8], [4, 5, 6, 10]],
        [[1, 2, 6, 10], [5, 6, 7, 9], [2, 6, 10, 11], [3, 5, 6, 7]],
        [[1, 4, 5, 6], [1, 4, 5, 9], [4, 5, 6, 9], [1, 5, 6, 9]],
        [[1, 2, 5, 6]],
    ]

    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.type = random.randint(0, len(self.figures) - 1)
        self.color = random.randint(1, len(colors) - 1)
        self.rotation = 0

    def image(self):
        return self.figures[self.type][self.rotation]

    def rotate(self):
        self.rotation = (self.rotation + 1) % len(self.figures[self.type])


class Tetris:
    level = 2
    score = 0
    state = "start"
    field = []
    height = 0
    width = 0
    x = 100
    y = 60
    zoom = 20
    figure = None

    def __init__(self, height, width):
        self.height = height
        self.width = width
        for i in range(height):
            new_line = []
            for j in range(width):
                new_line.append(0)
            self.field.append(new_line)

    def new_figure(self):
        self.figure = Figure(3, 0)

    def intersects(self):
        intersection = False
        for i in range(4):
            for j in range(4):
                if i * 4 + j in self.figure.image():
                    if i + self.figure.y > self.height - 1 or \
                            j + self.figure.x > self.width - 1 or \
                            j + self.figure.x < 0 or \
                            self.field[i + self.figure.y][j + self.figure.x] > 0:
                        intersection = True
        return intersection

    def break_lines(self):
        lines = 0
        for i in range(1, self.height):
            zeros = 0
            for j in range(self.width):
                if self.field[i][j] == 0:
                    zeros += 1
            if zeros == 0:
                lines += 1
                for i1 in range(i, 1, -1):
                    for j in range(self.width):
                        self.field[i1][j] = self.field[i1 - 1][j]
        self.score += lines ** 2

    def go_space(self):
        while not self.intersects():
            self.figure.y += 1
        self.figure.y -= 1
        self.freeze()

    def go_down(self):
        self.figure.y += 1
        if self.intersects():
            self.figure.y -= 1
            self.freeze()

    def freeze(self):
        for i in range(4):
            for j in range(4):
                if i * 4 + j in self.figure.image():
                    self.field[i + self.figure.y][j +
                                                  self.figure.x] = self.figure.color
        self.break_lines()
        self.new_figure()
        if self.intersects():
            game.state = "gameover"

    def go_side(self, dx):
        old_x = self.figure.x
        self.figure.x += dx
        if self.intersects():
            self.figure.x = old_x

    def rotate(self):
        old_rotation = self.figure.rotation
        self.figure.rotate()
        if self.intersects():
            self.figure.rotation = old_rotation


# 初始化游戏引擎
pygame.init()
# 定义一些颜色
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GRAY = (128, 128, 128)
size = (400, 500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Tetris")
# 循环,直到用户点击关闭按钮
done = False
clock = pygame.time.Clock()
fps = 25
game = Tetris(20, 10)
counter = 0
pressing_down = False
while not done:
    if game.figure is None:
        game.new_figure()
    counter += 1
    if counter > 100000:
        counter = 0
    if counter % (fps // game.level // 2) == 0 or pressing_down:
        if game.state == "start":
            game.go_down()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                game.rotate()
            if event.key == pygame.K_DOWN:
                pressing_down = True
            if event.key == pygame.K_LEFT:
                game.go_side(-1)
            if event.key == pygame.K_RIGHT:
                game.go_side(1)
            if event.key == pygame.K_SPACE:
                game.go_space()
        if event.type == pygame.KEYUP:
            if event.key == pygame.K_DOWN:
                pressing_down = False
    screen.fill(WHITE)
    for i in range(game.height):
        for j in range(game.width):
            pygame.draw.rect(screen, GRAY, [
                             game.x + game.zoom * j, game.y + game.zoom * i, game.zoom, game.zoom], 1)
            if game.field[i][j] > 0:
                pygame.draw.rect(screen, colors[game.field[i][j]],
                                 [game.x + game.zoom * j + 1, game.y + game.zoom * i + 1, game.zoom - 2, game.zoom - 1])
    if game.figure is not None:
        for i in range(4):
            for j in range(4):
                p = i * 4 + j
                if p in game.figure.image():
                    pygame.draw.rect(screen, colors[game.figure.color],
                                     [game.x + game.zoom * (j + game.figure.x) + 1,
                                      game.y + game.zoom *
                                      (i + game.figure.y) + 1,
                                      game.zoom - 2, game.zoom - 2])
    font = pygame.font.SysFont('Calibri', 25, True, False)
    font1 = pygame.font.SysFont('Calibri', 65, True, False)
    text = font.render("Score: " + str(game.score), True, BLACK)
    text_game_over = font1.render("Game Over :( ", True, (255, 0, 0))
    screen.blit(text, [0, 0])
    if game.state == "gameover":
        screen.blit(text_game_over, [10, 200])
    pygame.display.flip()
    clock.tick(fps)
pygame.quit()

2020-09-18T19:13:49 点赞:0

【作品秀】掌心出品必属精品--俄罗斯方块 中回复

python版俄罗斯方块:

import pygame
import random
colors = [
    (0, 0, 0),
    (120, 37, 179),
    (100, 179, 179),
    (80, 34, 22),
    (80, 134, 22),
    (180, 34, 22),
    (180, 34, 122),
]


class Figure:
    x = 0
    y = 0
    figures = [
        [[1, 5, 9, 13], [4, 5, 6, 7]],
        [[1, 2, 5, 9], [0, 4, 5, 6], [1, 5, 9, 8], [4, 5, 6, 10]],
        [[1, 2, 6, 10], [5, 6, 7, 9], [2, 6, 10, 11], [3, 5, 6, 7]],
        [[1, 4, 5, 6], [1, 4, 5, 9], [4, 5, 6, 9], [1, 5, 6, 9]],
        [[1, 2, 5, 6]],
    ]

    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.type = random.randint(0, len(self.figures) - 1)
        self.color = random.randint(1, len(colors) - 1)
        self.rotation = 0

    def image(self):
        return self.figures[self.type][self.rotation]

    def rotate(self):
        self.rotation = (self.rotation + 1) % len(self.figures[self.type])


class Tetris:
    level = 2
    score = 0
    state = "start"
    field = []
    height = 0
    width = 0
    x = 100
    y = 60
    zoom = 20
    figure = None

    def __init__(self, height, width):
        self.height = height
        self.width = width
        for i in range(height):
            new_line = []
            for j in range(width):
                new_line.append(0)
            self.field.append(new_line)

    def new_figure(self):
        self.figure = Figure(3, 0)

    def intersects(self):
        intersection = False
        for i in range(4):
            for j in range(4):
                if i * 4 + j in self.figure.image():
                    if i + self.figure.y > self.height - 1 or \
                            j + self.figure.x > self.width - 1 or \
                            j + self.figure.x < 0 or \
                            self.field[i + self.figure.y][j + self.figure.x] > 0:
                        intersection = True
        return intersection

    def break_lines(self):
        lines = 0
        for i in range(1, self.height):
            zeros = 0
            for j in range(self.width):
                if self.field[i][j] == 0:
                    zeros += 1
            if zeros == 0:
                lines += 1
                for i1 in range(i, 1, -1):
                    for j in range(self.width):
                        self.field[i1][j] = self.field[i1 - 1][j]
        self.score += lines ** 2

    def go_space(self):
        while not self.intersects():
            self.figure.y += 1
        self.figure.y -= 1
        self.freeze()

    def go_down(self):
        self.figure.y += 1
        if self.intersects():
            self.figure.y -= 1
            self.freeze()

    def freeze(self):
        for i in range(4):
            for j in range(4):
                if i * 4 + j in self.figure.image():
                    self.field[i + self.figure.y][j +
                                                  self.figure.x] = self.figure.color
        self.break_lines()
        self.new_figure()
        if self.intersects():
            game.state = "gameover"

    def go_side(self, dx):
        old_x = self.figure.x
        self.figure.x += dx
        if self.intersects():
            self.figure.x = old_x

    def rotate(self):
        old_rotation = self.figure.rotation
        self.figure.rotate()
        if self.intersects():
            self.figure.rotation = old_rotation


# 初始化游戏引擎
pygame.init()
# 定义一些颜色
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GRAY = (128, 128, 128)
size = (400, 500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Tetris")
# 循环,直到用户点击关闭按钮
done = False
clock = pygame.time.Clock()
fps = 25
game = Tetris(20, 10)
counter = 0
pressing_down = False
while not done:
    if game.figure is None:
        game.new_figure()
    counter += 1
    if counter > 100000:
        counter = 0
    if counter % (fps // game.level // 2) == 0 or pressing_down:
        if game.state == "start":
            game.go_down()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                game.rotate()
            if event.key == pygame.K_DOWN:
                pressing_down = True
            if event.key == pygame.K_LEFT:
                game.go_side(-1)
            if event.key == pygame.K_RIGHT:
                game.go_side(1)
            if event.key == pygame.K_SPACE:
                game.go_space()
        if event.type == pygame.KEYUP:
            if event.key == pygame.K_DOWN:
                pressing_down = False
    screen.fill(WHITE)
    for i in range(game.height):
        for j in range(game.width):
            pygame.draw.rect(screen, GRAY, [
                             game.x + game.zoom * j, game.y + game.zoom * i, game.zoom, game.zoom], 1)
            if game.field[i][j] > 0:
                pygame.draw.rect(screen, colors[game.field[i][j]],
                                 [game.x + game.zoom * j + 1, game.y + game.zoom * i + 1, game.zoom - 2, game.zoom - 1])
    if game.figure is not None:
        for i in range(4):
            for j in range(4):
                p = i * 4 + j
                if p in game.figure.image():
                    pygame.draw.rect(screen, colors[game.figure.color],
                                     [game.x + game.zoom * (j + game.figure.x) + 1,
                                      game.y + game.zoom *
                                      (i + game.figure.y) + 1,
                                      game.zoom - 2, game.zoom - 2])
    font = pygame.font.SysFont('Calibri', 25, True, False)
    font1 = pygame.font.SysFont('Calibri', 65, True, False)
    text = font.render("Score: " + str(game.score), True, BLACK)
    text_game_over = font1.render("Game Over :( ", True, (255, 0, 0))
    screen.blit(text, [0, 0])
    if game.state == "gameover":
        screen.blit(text_game_over, [10, 200])
    pygame.display.flip()
    clock.tick(fps)
pygame.quit()

2020-09-18T19:16:37 点赞:0

大家都用什么操作系统? 中回复

                                                                            密封线

emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了

台式机:windws7

笔记本:windws10

                                                                                          密封线

emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了emotion_编程猫_溜了溜了

2020-09-24T18:43:38 点赞:0

【跟风】用四个字形容你楼下的头像 中回复

我就一句话:Box 3

2020-09-24T18:48:10 点赞:0

《我的世界·主世界奇遇》《我的世界·海岛生存》《我的世界·源码精灵》临时评论区 中回复

2020-09-25T17:47:20 点赞:0

【小游戏】在键盘上随便打会怎么样? 中回复

和GV分以上通过合法商户使用的规范与完善的固体广告服应该涂一点体验服通过读一天付以上股份有台风苏一个浮图峪

2020-09-27T17:46:16 点赞:0

【代码岛3.0】抢先了解代码岛3.0编辑器的功能和开发进度!(长期更新) 中回复

我的天

 

2020-10-06T13:37:59 点赞:0

【编写程序欣赏结果】看你能忍多久 中回复

压缩后的代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
srand(time(0));
char a[8][5]={"红焖","白焖","红油","清蒸","油炸","煎炒","轰炸","生吞"};
char b[13][7]={"923784","楼主","茄子","黄瓜","卷心菜","西瓜","青蛙","蔡徐坤","篮球","钥匙","舍粒子","原子弹","蔡徐坤"};
for(int i=0;i<24;i++){
cout<<"今天晚上吃 "<<a[rand()%8]<<b[rand()%13]<<"\n";
}
cout<<"今天晚上吃 轰炸原子弹";
return 0;
}

2020-10-06T13:59:12 点赞:0

【Box3】急缺人 中回复

//快来人!!!!!!

2020-10-06T14:32:03 点赞:0

免费制作3D新家模型 中回复

快来抢购吧!

2020-10-22T19:21:00 点赞:0

月球大战链接 中回复

现在都有移动版的了:

center_image

2020-10-22T19:26:01 点赞:0

测试一下。 中回复

你是我爸爸(啊!!!!!!!!!!!!!!!!!!!!!!!!!)

2020-10-27T20:14:30 点赞:0

测试一下。 中回复

你是我宝贝(?~)

2020-10-27T20:15:32 点赞:0

【圣诞活动①】绘制圣诞素材,有机会上官方素材商城啦! 中回复

center_image

2020-12-05T20:19:07 点赞:1