pygame从入门到放弃(一)

2023-11-04

首先pip 那个pygame;
然后看代码;
临时写的,图片就不插了(防止舍友砍我,现在是凌晨。。。。)
[TOC]

井字棋游戏

# 此代码基本能立于不败之地;
import random
#可视化输出
def draw_Board(board):
    print('-----------')
    print(' ' + board[1] + ' | ' + board[2] + ' | ' + board[3])
    print('-----------')
    print(' ' + board[4] + ' | ' + board[5] + ' | ' + board[6])
    print('-----------')
    print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9])
    print('-----------')
#输入选择符号
def input_Player_Letter():
    letters = ''
    while not (letters == 'X' or letters == 'O'):
        print('Do you want to be X or O?')
        letters = input().upper()
    if letters == 'X':return ['X','O']
    else:return ['O','X']
#谁先?
def who_Goes_First():
    if random.randint(0, 1) == 0:
        return 'computer'
    else: return 'player'
#是否再来一次?
def play_Again():
    print('Do you want to play again?(yes or no?)')
    return input().lower().startswith('y')
#下子
def make_Move(board, letter, move):
    board[move] = letter
#判断是否有获胜者
def is_Winner(bo, le):
    return ((bo[7] == bo[8] == bo[9] == le) or
            (bo[4] == bo[5] == bo[6] == le) or
            (bo[1] == bo[2] == bo[3] == le) or
            (bo[7] == bo[4] == bo[1] == le) or
            (bo[8] == bo[5] == bo[2] == le) or
            (bo[9] == bo[6] == bo[3] == le) or
            (bo[7] == bo[5] == bo[3] == le) or
            (bo[1] == bo[5] == bo[9] == le))
#复制表盘测试
def get_Board_Copy(board):
    dupe_Board = []
    for i in board:
        dupe_Board.append(i)
    return dupe_Board
#判断位置是否为空
def is_Space_Free(board,move):
    return board[move] == ' '
#选手下棋
def get_Player_Move(board):
    move = ' '
    while move not in '1 2 3 4 5 6 7 8 9'.split() or not is_Space_Free(board,int(move)):
        print('What is your next move?')
        move = input()
    return int(move)
#随机下棋
def choose_Random_Move_From_List(board, movesList):
    possibleMoves = []
    for i in movesList:
        if is_Space_Free(board, i):
            possibleMoves.append(i)
    if len(possibleMoves ) != 0 :
        return random.choice(possibleMoves)#随机返回
    else:
        return None ##不在此中下棋
#简易AI
def get_Computer_Move(board, computerLetter):
    if computerLetter == 'X':
        playerLetter = 'O'
    else :playerLetter = 'X'
#是否有胜利的一步
    for i in range(1,10):
        copy = get_Board_Copy(board)
        if is_Space_Free(copy, i):
            make_Move(copy, computerLetter, i)
            if is_Winner(copy, computer_Letter):
                return i
#阻止选手胜利
    for i in range(1,10):
        copy = get_Board_Copy(board)
        if is_Space_Free(copy, i):
            make_Move(copy, player_Letter, i)
            if is_Winner(copy, player_Letter):
                return i
#占中间的
    if is_Space_Free(board, 5):
        return 5
#选角落不易输
    move = choose_Random_Move_From_List(board, [1,3,7,9])
    if move != None:
        return move
#别无后路
    return choose_Random_Move_From_List(board, [2, 4, 6, 8])
#判断棋盘是否满
def is_Board_Full(board):
    for i in range(1, 10):
        if is_Space_Free(board, i):
            return False
    return True
####主函数:
print("Welcome to 井字棋:")
while 1:
    the_Board = [" "]*10
    player_Letter, computer_Letter = input_Player_Letter()
    turn = who_Goes_First()
    print('The {} will go first.'.format(turn))
    game_Is_Playing = True
#游戏开始
    while game_Is_Playing:
        if turn == 'player':
            draw_Board(the_Board)
            move = get_Player_Move(the_Board)
            make_Move(the_Board, player_Letter, move)
#判断是否胜利
            if is_Winner(the_Board,player_Letter):
                draw_Board(the_Board)
                print("You have won the game!")
                game_Is_Playing = False
            else:
                if is_Board_Full(the_Board):
                    draw_Board(the_Board)
                    print('The game is a tie!')
                    break
                else:
                    turn = 'computer'  #交换下棋方
        else:
            move = get_Computer_Move(the_Board, computer_Letter)
            make_Move(the_Board, computer_Letter, move)
#判断胜利
            if is_Winner(the_Board,computer_Letter):
                draw_Board(the_Board)
                print("You have lost the game!")
                game_Is_Playing = False
            else:
                if is_Board_Full(the_Board):
                    draw_Board(the_Board)
                    print('The game is axx tie!')
                    break
                else:
                    turn = 'player'   #交换下棋方
    if not play_Again():
        break

hello world

#学会能画出图形
#这称不上是一个游戏
import pygame, sys
from pygame.locals import *

pygame.init()

window_Surface = pygame.display.set_mode((500, 400), 0, 32)
pygame.display.set_caption('Hello world!')

#RBG
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
#fonts
basic_Font = pygame.font.SysFont(None, 48)

text = basic_Font.render('Hello world~~', True, WHITE, BLUE)
text_Rect = text.get_rect()

text_Rect.centerx = window_Surface.get_rect().centerx
text_Rect.centery = window_Surface.get_rect().centery
window_Surface.fill(WHITE)

pygame.draw.polygon(window_Surface, GREEN, ((146, 0), (291, 106), (236, 277), (56, 277), (0, 106)))

pygame.draw.line(window_Surface, BLUE, (60, 60), (120, 60), 4)
pygame.draw.line(window_Surface, BLUE, (120, 60), (60, 120))
pygame.draw.line(window_Surface, BLUE, (60, 120), (120, 120), 4)

pygame.draw.circle(window_Surface, BLUE, (300, 50), 20, 1)

pygame.draw.ellipse(window_Surface, RED, (300, 250, 40, 80), 1)

pygame.draw.rect(window_Surface, RED,
                 (text_Rect.left - 20,
                  text_Rect.top - 20,
                  text_Rect.width + 40,
                  text_Rect.height + 40))

pixArry = pygame.PixelArray(window_Surface)
pixArry[480][380] = BLACK
del pixArry

window_Surface.blit(text, text_Rect)

pygame.display.update()

while 1:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

移动的方块

#和上式差不多,也是画出来的
import pygame, sys, time
import random
from pygame.locals import *

pygame.init()

window_Width = 400
window_Height = 400

window_Surface = pygame.display.set_mode((window_Width, window_Height), 0, 32)

pygame.display.set_caption('Animation')

down_Left = 1
down_Right = 3
up_Left = 7
up_Right = 9

move_Speed = 4
Black = (0, 0, 0)
RED = (255, 0, 0)
GREEN =(0, 255, 0)
BLUE = (0, 0, 255)

b1 = {'rect':pygame.Rect(300, 80, 50, 100),'color':RED, 'dir':up_Right} #红长方形
b2 = {'rect':pygame.Rect(120, 200, 20, 20),'color':GREEN, 'dir':up_Left}#绿
b3 = {'rect':pygame.Rect(100, 150, 60, 60),'color':BLUE, 'dir':down_Left}#蓝

blocks = [b1, b2, b3]

while 1:
    window_Surface.fill(Black)
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

    for b in blocks:
        #移动
        if b['dir'] == down_Left:
            b['rect'].left -= move_Speed
            b['rect'].top += move_Speed
        if b['dir'] == down_Right:
            b['rect'].left += move_Speed
            b['rect'].top += move_Speed
        if b['dir'] == up_Left:
            b['rect'].left -= move_Speed
            b['rect'].top -= move_Speed
        if b['dir'] == up_Right:
            b['rect'].left += move_Speed
            b['rect'].top -= move_Speed
#反弹
        if b['rect'].top < 0:
            if b['dir'] == up_Left:
                b['dir'] = down_Left
            if b['dir'] == up_Right:
                b['dir'] = down_Right
        if b['rect'].bottom > window_Height:
            if b['dir'] == down_Left:
                b['dir'] = up_Left
            if b['dir'] == down_Right:
                b['dir'] = up_Right
        if b['rect'].left < 0:
            if b['dir'] == down_Left:
                b['dir'] = down_Right
            if b['dir'] == up_Left:
                b['dir'] = up_Right
        if b['rect'].right > window_Width:
            if b['dir'] == down_Right:
                b['dir'] = down_Left
            if b['dir'] == up_Right:
                b['dir'] = up_Left
        pygame.draw.rect(window_Surface, b['color'], b['rect'])
#重置
    pygame.display.update()
    time.sleep(random.uniform(0.01,0.03)) #控制时间随机速度

移动的方块二

#♪(^∀^●)ノ随便改了一下,和上面的差不多
import pygame, sys, random
from pygame.locals import *
#查看是否吃到食物
def do_Rects_Overlap(rect1,rect2):
    for a, b in [(rect1, rect2), (rect2, rect1)]:
        if((is_Point_Inside_Rect(a.left, a.top, b))or
            (is_Point_Inside_Rect(a.left, a.bottom, b)) or
            (is_Point_Inside_Rect(a.right, a.top, b)) or
            (is_Point_Inside_Rect(a.right, a.bottom, b))):
            return True
    return False

def is_Point_Inside_Rect(x, y, rect):
    if (x > rect.left) and (x < rect.right) and (y > rect.top ) and (y < rect .bottom):
        return True
    else:
        return False
#初始化
pygame.init()

mainClock = pygame.time.Clock()
#游戏界面大小
window_Width = 800
window_Height = 600
window_Surface = pygame.display.set_mode((window_Width, window_Height),0,32)
#标题
pygame.display.set_caption("呼哧's game")

down_Left = 1
down_Right = 3
up_Left = 7
up_Right = 9
#速度
move_Speed = 4
#颜色
BLACK = (0, 0, 0)
GREEN  = (0, 255, 0)
WHITE = (255, 255, 255)
#食物计数
food_Counter = 0
new_Food = 4
#食物大小
food_Size = 2
bouncer = {'rect':pygame.Rect(300, 100, 50, 50), 'dir':down_Left}
foods = []
#初始化有6000个食物
for i in range(6000):
    foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                             random.randint(0, window_Height - food_Size),
                             food_Size, food_Size))

while True:

    for event in pygame.event.get():
        #关闭按钮
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
#增加食物功能
    food_Counter += 1
    if food_Counter >= new_Food :
        food_Counter = 0
        foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                                 random.randint(0, window_Height - food_Size),
                                 food_Size, food_Size))
#填充
    window_Surface.fill(BLACK)
#移动
    if bouncer['dir'] == down_Left :
            bouncer['rect'].left -= move_Speed
            bouncer['rect'].top += move_Speed

    if bouncer['dir'] == down_Right :
        bouncer['rect'].left += move_Speed
        bouncer['rect'].top += move_Speed

    if bouncer['dir'] == up_Left :
        bouncer['rect'].left -= move_Speed
        bouncer['rect'].top -= move_Speed

    if bouncer['dir'] == up_Right :
        bouncer['rect'].left += move_Speed
        bouncer['rect'].top -= move_Speed
#反弹
    if bouncer['rect'].top < 0:
        if bouncer['dir'] == up_Left:
            bouncer['dir'] = down_Left
        if bouncer['dir'] == up_Right:
            bouncer['dir'] = down_Right

    if bouncer['rect'].bottom > window_Height:
        if bouncer['dir'] == down_Left:
            bouncer['dir'] = up_Left
        if bouncer['dir'] == down_Right:
            bouncer['dir'] = up_Right

    if bouncer['rect'].left < 0:
        if bouncer['dir'] == up_Left:
            bouncer['dir'] = up_Right
        if bouncer['dir'] == down_Left:
            bouncer['dir'] = down_Right

    if bouncer['rect'].right > window_Width:
        if bouncer['dir'] == down_Right:
            bouncer['dir'] = down_Left
        if bouncer['dir'] == up_Right:
            bouncer['dir'] = up_Left
    #移动的方块
    pygame.draw.rect(window_Surface, WHITE, bouncer['rect'])
    #擦去绿色方块
    for food in foods[:]:
        if do_Rects_Overlap(bouncer['rect'], food):
            foods.remove(food)
    #显示绿色方块
    for i in range(len(foods)):
        pygame.draw.rect(window_Surface, GREEN, foods[i])
    #重置
    pygame.display.update()
    #类似time.sleep
    mainClock.tick(40)

可操作的方块一

#有了这个是不是就感觉有了天下一样呢,哈哈哈。^_^
#游戏简要说明:上下左右wsad或者上下左右;
#单机增加食物,x随机移动;
#食物变化具体请看代码;
import pygame, sys, random, time
from pygame.locals import *
#初始化
pygame.init()
main_Clock = pygame.time.Clock()
#界面设计
window_Width = 800
window_Height = 500

window_Surface = pygame.display.set_mode((window_Width, window_Height), 0, 32)
pygame.display.set_caption("Huchi's moving rect")
#颜色
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
WHITE = (255, 255, 255)
#食物
food_Counter = 0
new_Food = 40
food_Size = 20
player = pygame.Rect(300, 0, 50 ,50)
foods = []
for i in range(20):
    foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                             random.randint(0, window_Height - food_Size),
                             food_Size, food_Size))
#移动
move_Left = False
move_Right = False
move_Up = False
move_Down = False
#速度
move_Speed = 10

while True:

    for event in pygame.event.get():
        #关闭按钮
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
#按键
        if event.type == KEYDOWN:
            if event.key == K_LEFT or event.key == ord('a'):
                move_Right = False
                move_Left = True

            if event.key == K_RIGHT or event.key == ord('d'):
                move_Left = False
                move_Right = True

            if event.key == K_UP or event.key == ord('w'):
                move_Down = False
                move_Up = True

            if event.key == K_DOWN or event.key == ord('s'):
                move_Up = False
                move_Down = True
#松开
        if event.type == KEYUP:
            if event.key == K_ESCAPE:
                pygame.quit()
                sys.exit()

            if event.key == K_LEFT or event.key == ord('a'):
                move_Left = False
            if event.key == K_RIGHT or event.key == ord('d'):
                move_Right = False
            if event.key == K_UP or  event.key == ord('w'):
                move_Up = False
            if event.key == K_DOWN or event.key == ord('s'):
                move_Down = False
            if event.key == ord('x'):
                player.top = random.randint(0, window_Height - player.height)
                player.left = random.randint(0, window_Width - player.width)
        #鼠标增加
        if event.type == MOUSEBUTTONUP:
            foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                                     random.randint(0, window_Height - food_Size),
                                     food_Size,food_Size))
#食物增加
    food_Counter += 1
    if food_Counter >= new_Food:
        food_Counter = 0
        foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                                 random.randint(0, window_Height - food_Size),
                                 food_Size, food_Size))
        # 填充
    window_Surface.fill(BLACK)
#阻止越界
    if move_Down and player.bottom < window_Height:
        player.top  += move_Speed
    if move_Up and player.top > 0:
        player.top -= move_Speed
    if move_Left and player.left > 0:
        player.left -= move_Speed
    if move_Right and player.right <window_Width:
        player.left += move_Speed
#画玩者的rect
    pygame.draw.rect(window_Surface, WHITE, player)
#吃掉食物
    for food in foods[:]:
        if player.colliderect(food):
            foods.remove(food)
#画食物
    for i in range(len(foods)):
        pygame.draw.rect(window_Surface, GREEN, foods[i])
#动态化
    pygame.display.update()

    main_Clock.tick(40)
#胜利
    if len(foods) == 0:
        basic_Font = pygame.font.SysFont(None, 48)

        text = basic_Font.render('You won!', True, BLACK, BLUE)
        text_Rect = text.get_rect()
        window_Surface.blit(text, text_Rect)
        pygame.display.update()
        time.sleep(1)

入门期的第一个成果

#加入了图片,在上述的游戏中加入了图片与背景音乐(可以开关);
#我的图片与bgm是放在同目录的文件下的;
import pygame, sys, random, time
from pygame.locals import *

pygame.init()
main_Clock = pygame.time.Clock()

window_Width = 800
window_Height = 644
window_Surface = pygame.display.set_mode((window_Width, window_Height),0 ,32)
#颜色
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
#食物设置
food_Counter = 0
new_Food = 20
food_Size = 100
#玩家图片
player = pygame.Rect(300, 100, 40, 40)
player_Image = pygame.image.load('images\\player.jpg')#图片1
player_Stretched_Image = pygame.transform.scale(player_Image, (20, 20))


food_Image = pygame.image.load('images\\food.jpg')
foods_Image = pygame.transform.scale(food_Image, (20, 20))
foods = []
#初始20个食物
for i in range(20):
    foods.append(pygame.Rect(random.randint(0, window_Width - 20),
                            random.randint(0, window_Height - 20),
                            food_Size, food_Size ))

#移动
move_Left = False
move_Right = False
move_Up = False
move_Down = False
#速度
move_Speed = 10
#背景音乐
pickup_Sound = pygame.mixer.Sound('videos\\eat.wav')
pygame.mixer.music.load('videos\\bgm.mp3') #音乐
pygame.mixer.music.play(-1, 0.0)
music_Playing = True

while True:
    for event in pygame.event.get():
        #关闭按钮
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
#按键
        if event.type == KEYDOWN:
            if event.key == K_LEFT or event.key == ord('a'):
                move_Right = False
                move_Left = True

            if event.key == K_RIGHT or event.key == ord('d'):
                move_Left = False
                move_Right = True

            if event.key == K_UP or event.key == ord('w'):
                move_Down = False
                move_Up = True

            if event.key == K_DOWN or event.key == ord('s'):
                move_Up = False
                move_Down = True
#松开
        if event.type == KEYUP:
            if event.key == K_ESCAPE:
                pygame.quit()
                sys.exit()

            if event.key == K_LEFT or event.key == ord('a'):
                move_Left = False
            if event.key == K_RIGHT or event.key == ord('d'):
                move_Right = False
            if event.key == K_UP or  event.key == ord('w'):
                move_Up = False
            if event.key == K_DOWN or event.key == ord('s'):
                move_Down = False
            if event.key == ord('x'):
                player.top = random.randint(0, window_Height - player.height)
                player.left = random.randint(0, window_Width - player.width)
            if event.key == ord('m'):
                if music_Playing:
                    pygame.mixer.music.stop()
                else:
                    pygame.mixer.music.play(-1, 0.0)
                music_Playing = not music_Playing
        #鼠标增加
        if event.type == MOUSEBUTTONUP:
            foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                                     random.randint(0, window_Height - food_Size),
                                     food_Size,food_Size))

#食物增加
    food_Counter += 1
    if food_Counter >= new_Food:
        food_Counter = 0
        foods.append(pygame.Rect(random.randint(0, window_Width - food_Size),
                                 random.randint(0, window_Height - food_Size),
                                 food_Size, food_Size))
        # 填充
    window_Surface.fill(BLACK)
    # 阻止越界
    if move_Down and player.bottom < window_Height:
        player.top += move_Speed
    if move_Up and player.top > 0:
        player.top -= move_Speed
    if move_Left and player.left > 0:
        player.left -= move_Speed
    if move_Right and player.right < window_Width:
        player.left += move_Speed

    window_Surface.blit(player_Stretched_Image, player)

    for food in foods[:]:
        if player.colliderect(food):
            foods.remove(food)
            player = pygame.Rect(player.left, player.top, player.width + 2, player.height + 2)
            player_Stretched_Image = pygame.transform.scale(player_Image, (player.width, player.height))

            if music_Playing:
                pickup_Sound.play()
    if len(foods) >= 40:
        foods = []
    if len(foods) == 0:
        for i in range(20):
            foods.append(pygame.Rect(random.randint(0, window_Width - 20),
                                     random.randint(0, window_Height - 20),
                                     food_Size, food_Size))
#胜利条件
    if  player.height > window_Height:
        player.width = player.height = 1
        basic_Font = pygame.font.SysFont(None, 48)

        text = basic_Font.render('You won!', True, BLACK, BLUE)
        text_Rect = text.get_rect()
        window_Surface.blit(text, text_Rect)

        window_Surface.blit(player_Stretched_Image, player)
        pygame.display.update()
        time.sleep(3)
        window_Surface.blit(player_Stretched_Image, player)
        pygame.display.update()


    for food in foods:
        window_Surface.blit(food_Image, food)
    pygame.display.update()
    main_Clock.tick(40)

别拦我,我要去看源码,哈哈哈,interesting。:)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pygame从入门到放弃(一) 的相关文章

随机推荐

  • HttpClient4 Post XML到一个服务器上

    现在网上介绍的HttpClient基本上全是3 x版本的内容 HttpClient4的API变化相对3已经变化很大 对HttpClient4做了简单的研究后 完成了一个HttpClient4 Post XML功能 对于POST方式 最先想到
  • 解决camera1 onPreviewFrame()会阻塞UI线程

    转自 https blog csdn net qq 31939617 article details 86360335 https www huaweicloud com zhishi arc 13664997 html 注意 onPrev
  • 二分法查找(Java)

    需求 给定一个 n 个元素有序的 升序 整型数组 nums 和一个目标值 target 写一个函数搜索 nums 中的 target 如果目标值存在返回下标 否则返回 1 示例 输入 nums 1 0 3 5 9 12 target 9 输
  • 单链表和顺序表的初始化及插入、删除、获取元素操作实现

    1 声明一个节点类 节点类 public class Node int data 数据域 Node next 指针域 public Node int data this data data public Node 2 不带头结点的单链表实现
  • vue3组件通信方式 二

    目录 ref与 parent ref 在父组件挂载完毕获取组件实例 parent可以获取某一个组件的父组件实例VC 案例 provide与inject provide提供数据 inject 获取数据 案例 pinia 大仓库 注册store
  • 42黑马QT笔记之Linux下Tcp/Udp通信过程

    42黑马QT笔记之Linux下Tcp Udp通信过程 1 Linux下Tcp通信过程 1 第一次握手 执行connect 2 第二次握手 accept 返回 3 第三次握手 connect 返回 4 共有三个套接字 客户端1个fd 服务端一
  • c++11增加的变参数模板,今天总算整明白了

    本篇文章介绍一下c 11中增加的变参数模板template
  • C运行时库(C Run-time Library)详解

    一 什么是C运行时库 1 C运行时库就是 C run time library 是 C 而非 C 语言世界的概念 取这个名字就是因为你的 C 程序运行时需要这些库中的函数 2 C 语言是所谓的 小内核 语言 就其语言本身来说很小 不多的关键
  • AIX系统文件压缩解压缩及性能诊断常用命令

    AIX系统文件压缩解压缩及性能诊断常用命令 磁带设备 顺序读取 文件类型 dev rmtx dev rmtx 1 dev rmtx 2 掌握 zip tar tape archive 保留原有权限 没有压缩 只是打包 创建 tar cvf
  • Basic Level 1091 N-自守数 (15分)

    题目 如果某个数 K 的平方乘以 N 以后 结果的末尾几位数等于 K 那么就称这个数为 N 自守数 例如 3 9 2 2 25392
  • 【python】excel文件(.xls文件)处理

    目录 概述 xlrd xlwt xlutils 概述 xlrd 用于读取文件 xlwt 用于写入文件 xlutils 是两个工具包的桥梁 也就是通过xlrd 读取 xls文件 然后通过xlutils 将文件内容交给xlwt处理并且保存 xl
  • 新手linux安装vasp_一步一步教你如何在linux 下安装VASP 【真的是从零开始】

    首先我是一个linux 小白 只接触过linux 的基本用法 听说VASP 编译很复杂 故想学习之 如果大神见了 请直接飘过 非常期待和大家互动交流 下面就直接进入主题 如何在linux 下面安装VASP 首先我想说说什么叫编译 为什么要编
  • 线阵相机、镜头及光源的选型

    线阵相机顾名思义就是取像是成线性的 它的传感器是成线型的 举个例子 比如面阵相机的分辨率是640 480就是说这个相机横向有640个像元 纵向有480个像元 而线阵相机分辨率只体现在横向 比如2048像素的线阵相机就是说横向有2048个像元
  • 颜色空间YUV简介

    YUV概念 YUV是被欧洲电视系统所采用的一种颜色编码方法 属于PAL Phase Alternation Line 是PAL和SECAM模拟彩色电视制式采用的颜色空间 其中的Y U V几个字母不是英文单词的组合词 Y代表亮度 其实Y就是图
  • java集合的copy

    java拷贝集合的方法有很多种 常用的比较简单的做法有两种 直接使用集合构造方法实现浅拷贝 这种方法只是保证list和listCopy的引用不一样 但是集合元素的引用时一样的 List
  • 生产管理MES系统框架

    1 总体框架描述 生产管理MES系统框架涵盖了涉及生产制造范畴内的所有业务管理内容 包括 产品生产数据 销售订单管理 材料需求计算和计划 采购管理 仓库物流管理 主生产计划 生产作业管理 生产过程物料加工 生产过程工装组装管理 品质管理 检
  • idea 插件的使用 进阶篇(个人收集使用中的)

    idea 插件的使用 进阶篇 个人收集使用中的 恭喜你 如果你已经看到这篇文章 证明在idear使用上已经初有小成 那么就要向着大神进发了 下边就是大神之路 插件的设置 在 IntelliJ IDEA 的安装讲解中我们其实已经知道 Inte
  • Quartz和Spring Task定时任务的简单应用和比较

    一 Quartz 引入quartz的jar包 配置文件中定义org springframework scheduling quartz MethodInvokingJobDetailFactoryBean 并指定它的targetObject
  • 理解HTML、CSS、javascript之间的关系

    理解HTML CSS javascript之间的关系 版权属于 博客园 牧云流 本文作者 牧云流 原文链接 https www cnblogs com dreamingbaobei p 10407626 html 网页主要有三部分组成 结构
  • pygame从入门到放弃(一)

    首先pip 那个pygame 然后看代码 临时写的 图片就不插了 防止舍友砍我 现在是凌晨 TOC 井字棋游戏 此代码基本能立于不败之地 import random 可视化输出 def draw Board board print prin