首页 > 新闻频道 > 民俗  
硬核浪漫!圣诞节给对象送礼的5个最没用小技巧
2021-12-24 18:27:32  来源:中国文化报道网  作者:Admin  分享:

 《圣诞节里吃饺子》

 
腊月廿四平安夜,过了今晚过圣诞。
圣诞虽说是洋节,吃口饺子也和谐。
圣诞擀了饺子皮,福禄寿喜都到齐。
圣诞饺子蘸着醋,来年出门不迷路。
圣诞饺子不吃饱,大年三十没棉袄。
不到长城非好汉,不吃饺子无圣诞。
无!!!圣!!!!诞!!!
 
(定场诗完)
 
 
今年的圣诞节恰逢周末,许多观众朋友结束了一周辛勤的学习和工作,正好借此机会约上对象或者是正在追的对象出去玩耍。
 
图片
 
小冷风一吹,小手手一牵,小礼物一送,小浪漫气氛一起,事情就这么成了图片
 
但送什么礼物、怎么送礼物,是一门艺术!在当今社会,人们对礼物早已不再满足于物质层面的需求,而更追求精神层面的仪式感。
 
图片
 
你送个苹果,今晚吃完,过三天对方已经不记得你送过啥了。你送束花,现在的人都手笨,哪还会养花?你送个几万块的名表名包,对方会觉得你只是想用金钱收买自己,格局又小了(这一条我没试过所以不太确定,但我猜应该是这样)。
 
在我看来,送礼最重要的是创意!一个好的创意,既能展现你的特点,又能给对方留下深刻印象,是非常加分的。
 
考虑到我的粉丝群体通常比较喜欢理工科的硬核浪漫。今天,毕老师就来给大家分享5个很适合在圣诞节送的礼物,绝对好用,不好用我论文送你二作。
 
 
一、用Python写一张贺卡
 
Python是一门面向对象编程的语言,天然很适合用于面向你的对象送礼物。
 
 
 
 
我在这里帮大家找到了一段用Python生成圣诞贺卡的程序,来自https://www.codetoday.co.uk/christmas。只要放到编译器里直接一run,就会出现一张非常温馨可爱的圣诞贺卡!相信我,没有人能抵抗如此用心的设计。
 
话不多说我们直接上代码!
# https://www.codetoday.co.uk/christmas
import turtle
import random
import time
width = 600
height = 500
window = turtle.Screen()
window.setup(width, height)
window.bgcolor("sky blue")
window.title("Merry Christmas")
snowball_rate = 1, 3
snowball_size = 5, 15
wind_change = 1, 5
max_wind = 3
# Create all circle-shaped objects
 
 
def make_circle(turtle_name, x, y, size, colour):
    turtle_name.color(colour)
    turtle_name.penup()
    turtle_name.setposition(x, y)
    turtle_name.dot(size)
 
 
# Create new snowballs and store in list
list_of_snowballs = []
 
 
def make_snowball():
    snowball = turtle.Turtle()
    snowball.color("white")
    snowball.penup()
    snowball.setposition(random.randint(-2*width, width/2), height/2)
    snowball.hideturtle()
    snowball.size = random.randint(*snowball_size)
    list_of_snowballs.append(snowball)
 
 
def move_snowball(turtle_name, falling_speed=1, wind=0):
    turtle_name.clear()
    turtle_name.sety(turtle_name.ycor() - falling_speed)
    if wind:
        turtle_name.setx(turtle_name.xcor() + wind)
    turtle_name.dot(turtle_name.size)
 
 
# Snowman: body
snowman = turtle.Turtle()
x_position = 0
y_positions = 75, 0, -100
size = 75
for y in y_positions:
    make_circle(snowman, x_position, y, size, "white")
    size = size * 1.5
# Snowman: buttons
button_seperation = 25
button_y_positions = [y_positions[1]-button_seperation,
                      y_positions[1],
                      y_positions[1]+button_seperation]
for y in button_y_positions:
    make_circle(snowman, x_position, y, 10, "black")
# Snowman: eyes
y_offset = 10
x_seperation = 15
for x in x_position-x_seperation, x_position+x_seperation:
    make_circle(snowman, x, y_positions[0] + y_offset, 20, "green")
    make_circle(snowman, x, y_positions[0] + y_offset, 10, "black")
# Snowman: nose
snowman.color("orange")
snowman.setposition(x_position - 10, y_positions[0]-y_offset)
snowman.shape("triangle")
snowman.setheading(200)
snowman.turtlesize(0.5, 2.5)
window.tracer(0)
# Ground
grass = turtle.Turtle()
grass.fillcolor("forest green")
grass.penup()
grass.setposition(-width/2, -height/2)
grass.begin_fill()
for _ in range(2):
    grass.forward(width)
    grass.left(90)
    grass.forward(70)
    grass.left(90)
grass.end_fill()
ground = turtle.Turtle()
for x in range(int(-width/2), int(width/2), int(width/200)):
    make_circle(ground, x, -180, random.randint(5, 20), "white")
text = turtle.Turtle()
text.color("red")
text.penup()
text.setposition(-100, 170)
text.write("Merry Christmas", font=(
    "Apple Chancery", 30, "bold"), align="center")
text.setposition(130, 140)
text.color("dark green")
text.write("Dao", font=("Avenir", 30, "bold"), align="right")
text.color("black")
text.write("Bi", font=("Avenir", 30, "normal"), align="left")
text.setx(50)
text.write("from", font=("Apple Chancery", 20, "bold"), align="right")
text.hideturtle()
time_delay = 0
start_time = time.time()
wind = 0
wind_delay = 5
wind_timer = time.time()
wind_step = 0.1
while True:
    if time.time() - start_time > time_delay:
        make_snowball()
        start_time = time.time()
        time_delay = random.randint(*snowball_rate)/10
    for snowball in list_of_snowballs:
        move_snowball(snowball, wind=wind)
        if snowball.ycor() < -height/2:
            snowball.clear()
            list_of_snowballs.remove(snowball)
    if time.time() - wind_timer > wind_delay:
        wind += wind_step
        if wind >= max_wind:
            wind_step = -wind_step
        elif wind <= 0:
            wind_step = abs(wind_step)
        wind_timer = time.time()
        wind_delay = random.randint(*wind_change)/10
    window.update()
turtle.done()
 
 
 
运行后是这样的,会跳出一个动画卡片:
 
图片
 
 
看啊!雪人栩栩如生,瞪着萌萌的大眼睛图片雪花片片飘落,恰如此刻的美景图片看到这种浪漫的意境不感动的,那还是人?
 
请大家在评论区告诉我,看到这张图,你,哭了吗?
 
 
二、用turtle画一个饺子
 
当然,有些同学可能会说,我们不过洋节!那没关系,我们在圣诞节吃个饺子,不就中学为体西学为用了么图片
 
下面我们用Python的turtle库为大家画个饺子,直接上代码!
import turtle
turtle.setup(600,400)
turtle.penup()
turtle.goto(-180,-80)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor('black')
turtle.seth(-20)
turtle.circle(500,40)
turtle.seth(110)
turtle.circle(182,140)
turtle.seth(150)
for i in range(4):
    turtle.circle(-35,143)
    turtle.circle(19,110)
turtle.circle(-35,135)
turtle.left(5)
turtle.circle(19,100)
turtle.circle(-26.5,150)
 
turtle.penup()
turtle.goto(-149,-9)
turtle.pendown()
turtle.seth(-40)
turtle.fd(5)
 
turtle.penup()
turtle.goto(-83,52)
turtle.pendown()
turtle.seth(-67)
turtle.fd(20)
 
turtle.penup()
turtle.goto(2,70)
turtle.pendown()
turtle.seth(-97)
turtle.fd(24)
 
turtle.penup()
turtle.goto(83,42)
turtle.pendown()
turtle.seth(-120)
turtle.fd(15)
 
turtle.penup()
turtle.goto(145,-24)
turtle.pendown()
turtle.seth(-155)
turtle.fd(5)
 
turtle.penup()
turtle.pensize(12)
turtle.goto(-45,-20)
turtle.pendown()
turtle.dot()
turtle.penup()
turtle.goto(40,-20)
turtle.pendown()
turtle.dot()
 
turtle.penup()
turtle.pensize(5)
turtle.goto(-25,-50)
turtle.seth(5)
turtle.pendown()
turtle.fd(47)
 
turtle.penup()
turtle.goto(-25,-50)
turtle.seth(-85)
turtle.pendown()
turtle.circle(25,175)
 
turtle.penup()
turtle.pensize(20)
turtle.pencolor('pink')
turtle.goto(-60,-50)
turtle.pendown()
turtle.dot()
turtle.penup()
turtle.goto(58,-49)
turtle.pendown()
turtle.dot()
 
turtle.penup()
turtle.goto(-200,300)
turtle.done()
 
 
 
画出来是这样的
 
图片
 
 
小小的turtle,飘若浮云,矫若惊龙图片而最后的粉粉脸颊更是点睛之笔图片收到这个饺子程序但没有爱上你的,那还是人?
 
特别要提醒的是,大家在给对象送上面的贺卡和饺子时,一定要直接把.py文件发过去!
 
这样如果对方因为python环境、版本问题无法运行甚至压根电脑里没装python的话,你就可以再去TA家里帮着调试代码,进一步增加了双方接触的机会,还能展现你强大的码力。
 
千万不要贴心地把贺卡和饺子给对方用pyinstaller打包成exe可执行文件,一来不够酷炫,二来万一你对象用的是linux系统,就打不开exe,你的心血就白费了图片
 
 
三、用Matlab画一棵圣诞树
 
众所周知,Matlab除了生孩子,啥都能干。这是一篇Matlab画圣诞树教程,非常美观大方,推荐给大家https://blog.csdn.net/liu08_13/article/details/111609822。
 
代码如下
close all;clear;clc
 
% setup
 
snow=450;    % number of snow flakes [0 .. 5000]
 
% draw tree
 
h=0:0.2:25; %vertical grid
 
[X,Y,Z] = cylinder(tree(h)); %produce a tree formed cylinder
 
Z=Z*25; %scale to the right heigth
 
%Add some diffusion to the surface of the tree to make it look more real
 
treeDiffusion=rand(126,21)-0.5;%some horizontal diffusion data
 
%add diffusion to the grid points
 
for cnt1=1:21    
 
    for cnt2=16:126%starting above the trunk
 
        %get the angle to always diffuse in direction of the radius
 
        angle=atan(Y(cnt2,cnt1)/X(cnt2,cnt1));
 
        %split the diffusion in the two coordinates, depending on the angle
 
        X(cnt2,cnt1)=X(cnt2,cnt1)+cos(angle)*treeDiffusion(cnt2,cnt1);
 
        Y(cnt2,cnt1)=Y(cnt2,cnt1)+sin(angle)*treeDiffusion(cnt2,cnt1);
 
        %some Vertical diffusion for each point
 
        Z(cnt2,cnt1)=Z(cnt2,cnt1)+(rand-0.5)*0.5;
 
    end    
 
end
 
%draw the tree
 
h0  = figure('Units','inches');
 
pos = h0.Position;
 
pos(1) = 1; pos(2) = 1;
 
pos(3) = 7; pos(4) = 7;
 
h0.Position = pos;
 
surfl(X,Y,Z,'light')
 
%% View and format
 
%Use as nice green color map (darker at the bottom, lighter at the top)
 
r=(0.0430:(0.2061/50):0.2491)';%red component
 
g=(0.2969:(0.4012/50):0.6981)';%green component
 
b=(0.0625:(0.2696/50):0.3321)';%blue component
 
map=[r,g,b];%join in a map
 
for cnt=1:6
 
    %change the lower part to brown for the trunk
 
    map(cnt,:)=[77,63,5]/265;
 
end
 
colormap(map)%set the map
 
view([-37.5,4])%Change the view to see a little more of the Actual 3D tree
 
lighting phong %some nice lighting
 
shading interp %remove grid and smoothen the surface color
 
axis equal %takes care of display in the right proportion
 
axis([-10 10 -10 10 0 30]) %give some more axis space (for the snow later)
 
axis off %but don't show axis
 
hold on %to draw the rest
 
title('Merry Christmas','color','w',...
 
    'fontsize',25,...
 
    'fontweight','Bold')%self explaining
 
set(gcf,'color',[22 32 51]./255)
 
% Presents
 
%Draw some presents around the tree (each with random color)
 
drawPresent(2,-4,0,3,3,2);
 
drawPresent(-4,3,0,2,3,1.5);
 
drawPresent(5,3,0,4,3,3);
 
drawPresent(-14,-5,0,6,3,1);
 
drawPresent(-9,-10,0,2,2,2);
 
drawPresent(0,4,0,4,3,3);
 
drawPresent(-6,-13,0,3,3,3);
 
%% Snow
 
%create some random 3D coordinates for the snow (amount as in setup above)
 
snowX=(rand(snow-100,1)*25-12.5);
 
snowY=(rand(snow-100,1)*25-12.5);
 
snowZ=(rand(snow-100,1)*27);
 
color0 = jet(length(snowX));
 
%Note:Some flakes will end up IN the tree but just can't be seen then
 
for ii = 1:length(snowX)
 
    plot3(snowX(ii),snowY(ii),snowZ(ii),'*','color',color0(ii, :),'markersize',randi(15))%plot coordinates as white snow flakes
 
    %     plot3(snowX(ii),snowY(ii),snowZ(ii),'*','color',color0(ii, :))%plot coordinates as white snow flakes
 
end
 
h=plot3(snowX,snowY,snowZ,'w*');
 
im = {};
 
for ii = 1:180
 
    if mod(ii,3) == 0
 
        h.Visible = 'off';
 
        snowX=(rand(snow,1)*25-12.5);
 
        snowY=(rand(snow,1)*25-12.5);
 
        snowZ=(rand(snow,1)*27);
 
        h=plot3(snowX,snowY,snowZ,'w*');
 
        %         pause(0.25)
 
    else
 
        view([ii,4])
 
        %         pause(0.1)
 
    end
 
    if ii > 85
 
        frame = getframe(gcf);
 
        im{ii} = frame2im(frame);
 
    end
 
end
 
hold off%Done
 
im(cellfun(@isempty,im))=[];
 
% end % of function
 
file2write = 'chris.gif';
 
for ii = 1:length(im)
 
    [A, map] = rgb2ind( im{ii}, 256);
 
    if ii == 1
 
        imwrite(A, map, file2write, 'gif','LoopCount',Inf,'DelayTime', 0.12);
 
    else
 
        imwrite(A, map, file2write, 'gif','WriteMode','append','DelayTime', 0.12);
 
    end
 
end
 
 
 
%% ============= private functions
 
 
 
function r=tree(h)%Gives a profile for the tree
 
for cnt=1:length(h)
 
    
 
    if(h(cnt)==0)%no Width at the bottom. Ensures a "closed" trunk
 
        r(cnt)=0;
 
    end
 
    %smaller radius for the trunk
 
    if (h(cnt)>0 && h(cnt)<=3)
 
        r(cnt)=1.5;
 
    end
 
    
 
    %reduce radius gradually from 8 to 0. Note: will only work with a trunk heigth
 
    %of 3 and a whole tree heigth of 25. Scale the height of the tree in
 
    %the "draw tree" section, since the cylinder command will return a 1
 
    %unit high cylinder anyway
 
    if(h(cnt)>3)
 
        r(cnt)=8-(h(cnt)-3)*0.3636;
 
    end
 
    
 
end
 
 
 
end % of function
 
 
 
%Draws a present with the given coordinate + size in a random color
 
%Note:Given coordinates apply to the lower front + left corner of the
 
%present (the one closest to the viewer) as seen in the plot
 
function drawPresent(dx,dy,dz,scalex,scaley,scalez)
 
 
 
%the standard present coordinates
 
presentX=[0.5 0.5 0.5 0.5 0.5; 0 1 1 0 0; 0 1 1 0 0; 0 1 1 0 0; 0.5 0.5 0.5 0.5 0.5];
 
presentY=[0.5 0.5 0.5 0.5 0.5; 0 0 1 1 0; 0 0 1 1 0; 0 0 1 1 0; 0.5 0.5 0.5 0.5 0.5];
 
presentZ=[0 0 0 0 0; 0 0 0 0 0; 0.5 0.5 0.5 0.5 0.5; 1 1 1 1 1; 1 1 1 1 1];
 
 
 
%draw some presents with random colors
 
%scale present and move it to the right place and get the plot handle
 
myHandle=surf((presentX*scalex+dx),(presentY*scaley+dy), (presentZ*scalez+dz));
 
%some random color map
 
randColorMap(:,:,1)=repmat(rand,[5,5]);%r component
 
randColorMap(:,:,2)=repmat(rand,[5,5]);%g component
 
randColorMap(:,:,3)=repmat(rand,[5,5]);%b component
 
%Assign colormap just to the plot handle object of the present, so the tree
 
%does not change color
 
set(myHandle,'CData',randColorMap)
 
shading interp %Nice shding + without grid
 
 
 
end % of function
 
 
 
 
 
出来的效果也是很闪耀的!喜欢一棵树的眼神是藏不住的图片
 
图片
 
 
如果你对象没有Matlab,那你正好去TA家给装一个。Matlab安装包十几个G,安装的时候够你们玩点有的没的东西了图片
 
 
四、用Matlab彻底征服对方!
 
人一旦开始用Matlab做数学计算以外的东西,就很容易堕入它的黑暗面。网上的各种玩法会让Matlab公司觉得15500元卖你这个软件都亏了。
 
 
 
 
可以说是造型精美,算法巧妙。推荐大家一定要试试,试完了一定要把你对象的回复截图发给我。
 
 
五、用AI给对方画几幅画
 
近年来随着人工智能的发展,AI已经可以根据词语来画画。比如著名的模型GPT-3,你给它输入一个词语,它就会自动按这个词语创造图片!像你输入“牛油果椅子”,它就会自己原创出下面这些图片,非常Amazing!
 
图片
 
清华之前也做过一个类似的叫Cogview。比如我们输入“圣诞节快乐”,AI就会自动创作出一些很贴切的图片。
 
 
 
我们放大看看,世界上最先进的AI模型是否给你的圣诞节增添了一丝节日的氛围呢图片图片

 

相关新闻

    无相关信息

◎版权作品,未经中国文化报道网书面授权,严禁转载,违者将被追究法律责任。




关于我们 - 媒体合作 - 广告服务 - 版权声明 - 联系我们 - 友情链接 - 网站地图

Copyright 2015-2019. 中国文化报道网 www.cgia.cn All rights reserved.

违法和不良信息举报邮箱:jubao@cgia.cn

未经过本站允许,请勿将本站内容传播或复制