深圳有哪些做网站的公司/网站关键词优化案例

深圳有哪些做网站的公司,网站关键词优化案例,服装网站建设,wordpress+翻页函数1 效果 1.1 截图 游戏运行: 存档: 1.2 游玩警告 注意!不要修改装备概率,装备的概率都是凑好的数字。如果想要速升,修改灵石数量 2 代码 2.1 代码大纲 1. 游戏框架与初始化 控制台操作:通过 gotoxy() …

1 效果

1.1 截图

游戏运行:

存档:

 1.2 游玩警告

注意!不要修改装备概率,装备的概率都是凑好的数字。如果想要速升,修改灵石数量

2 代码

2.1 代码大纲

1. 游戏框架与初始化

  • 控制台操作:通过 gotoxy() 和 hide_cursor() 控制光标位置与可见性,color() 函数设置颜色,实现动态界面。

  • 全局变量:管理玩家等级(Lv)、经验(Exp)、关卡(G)、灵石(SpiritStone)等核心数据,以及装备稀有度概率(如 GreyGreen)。

  • 初始化函数 init():重置装备数据、加载存档、设置控制台颜色并隐藏光标。


2. 装备系统

  • 结构体 equipment

    • 属性 稀有度(rare)、等级(lv)、类型(type)、名称(name)、伤害(damage)、生命值(HP)和威力(power)。

    • 动态颜色 (ecolor()):根据稀有度显示不同颜色(如灰色、绿色),高稀有度装备(如红色、彩虹)使用 HSL 动态渐变。

    • 装备生成 (init()):基于类型和稀有度生成名称(如“玄铁重剑”)、计算属性,稀有度越高加成越大(如彩虹装备伤害+80%)。


3. 战斗与关卡

  • 战斗循环:玩家与敌人轮流攻击,血量(HPnowMHPnow)实时更新,伤害由装备属性累加计算。

  • 关卡推进:击败敌人后关卡(G)递增,敌人血量根据公式 MHP = G * G 动态增长。

  • 装备掉落:击败敌人随机生成新装备,玩家可选择替换或分解,分解获得灵石和经验。


4. 成长与升级

  • 角色升级:经验值(Exp)满后提升等级,解锁更高境界(如筑基期、金丹期)。

  • 仙树升级:消耗灵石升级仙树(TreeLV),调用 TreeUP() 调整稀有度概率(如减少灰色装备概率,增加橙色概率)。

  • 属性计算:玩家总血量(HP)和伤害(damage)由装备属性累加,功力(power)进行装备战力估算。


5. 存档与颜色处理

  • 存档机制SaveRecord() 和 LoadRecord() 将装备数据、等级、灵石等保存至文件(equipment.save 和 Tree.save)。

  • HSL转RGBHSLtoRGB() 函数实现动态颜色效果(如至宝装备颜色渐变),增强视觉表现。


6. 关键逻辑细节

  • 装备生成概率:根据 GreyGreen 等全局变量加权随机,高关卡解锁更稀有装备。

  • 时间控制times 变量控制攻击动画节奏,Sleep(20) 调节循环速度。

2.2 游戏代码

#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <time.h>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>#define Rgrey 1
#define Rgreen 2
#define Rblue 3
#define Rpurple 4
#define Rorange 5
#define Rred 6
#define Rgold 7
#define Rlightblue  8
#define Rrainbow 9
#define RRrainbow 10
#define Rblack 11
#define RRblack 12using namespace std;int Lv = 0, Exp = 0, Exp2 = 50;
int times = 0;int G = 1;
int TreeLV = 1;
int Grey = 33;
int Green = 31;
int Blue = 25;
int Purple = 11;
int Orange = 0;
int Red = 0;
int Gold = 0;
int Lightblue = 0;
float Rainbow = 0;
float Rainbow2 = 0;
float Black = 0;
float Black2 = 0;int EquipmentLV = 1;
long long SpiritStone = 0;struct equipment;
struct COLORRGB;
int getrand(int min, int max);
void gotoxy(int x, int y);
void hide_cursor();
void color(int r, int g, int b);
void color2(COLORRGB c);
void init();
void TreeUP();
void SaveRecord();
void LoadRecord();
void ecolor(short rare);COLORRGB HSLtoRGB(float h, float s, float l);struct COLORRGB { int r, g, b; };
struct equipment
{short rare = 0;int lv = 1;char type[20] = { "" };char name[20] = { "" };int damage = 0;long long HP = 0;long long power = 0;void ecolor(){switch (rare){case Rgrey: color(140, 140, 140); break;case Rgreen: color(0, 153, 0); break;case Rblue: color(0, 0, 153); break;case Rpurple: color(102, 0, 204); break;case Rorange: color(255, 153, 51); break;case Rred:color(175 + (times / 2) % 80, 0, 0);if ((times / 2) % 160 >= 80) color(255 - (times / 2) % 80, 0, 0);break;case Rgold:color(220 + (times / 3) % 20, 220 + (times / 3) % 20, 0);if ((times / 3) % 40 >= 20) color(240 - (times / 3) % 20, 240 - (times / 3) % 20, 0);break;case Rlightblue:{float H = 211;float S = 1;if (times % 200 >= 100) color2(HSLtoRGB(H, S, 0.85f - float(times % 100) / 500));else color2(HSLtoRGB(H, S, 0.65f + float(times % 100) / 500));break;}case Rrainbow:{float S = 1;float L = 0.5f;color2(HSLtoRGB(times % 720 / 2, S, L));break;}case RRrainbow:{float S = 1;float L = 0.5f;color2(HSLtoRGB(times % 360, S, L));break;}case Rblack:{float H = 0;float S = 0;if (times % 200 >= 100){color2(HSLtoRGB(H, S, 0.25f - float(times % 100) / 400));}else{color2(HSLtoRGB(H, S, float(times % 100) / 400));}break;}case RRblack:{float H = 0;float S = 0;if (times % 200 >= 100){color2(HSLtoRGB(H, S, 0.5f - float(times % 100) / 200));}else{color2(HSLtoRGB(H, S, float(times % 100) / 200));}break;}default: color(245, 245, 245);}}void init(short _rare, short _type){lv = Lv + 1;rare = _rare;const char* types[9] = { "头盔", "护甲", "护腿", "披风", "护臂", "护腕", "武器", "宝物" };strcpy_s(type, types[_type]);const char* names[8][13] = {{"", "铜盔", "玄铁帽", "岩骨护盔", "星玄流云盔", "淬星龙鳞冠", "紫淬寰宇冠", "鸿蒙太虚冠", "九转星璇盔", "灭世星辰冠", "灵宝-星辰冠", "玄龙", "道"},{"", "布衣", "藤心软甲", "玄龟灵甲", "金丝蟠龙铠", "九霄雷纹甲", "紫淬龙宇铠", "无相法身袍", "混元星璇袍", "寰宇灭世铠", "灵宝-寰宇铠", "破天", "法"},{"", "草编护腿", "铁锁护腿", "青蟒护腿", "玄冰踏云腿", "金乌焚尘腿", "流风逐月腿", "八荒六合腿", "太乙青冥腿", "日月琼天腿", "灵宝-日月腿", "神霄", "神"},{"", "布织斗篷", "狼裘披风", "玄鹤羽氅", "赤霞飞云帔", "金乌焰翎", "乾坤一气幡", "八荒太极袍", "太虚寰宇氅", "万象归墟幡", "灵宝-归墟幡", "护道", "霄"},{"", "灰布缠臂", "铜虎臂", "赤蛟吞云臂", "玄铁护心臂", "紫电惊雷臂", "龙魂缚天臂", "盘龙天蚕扣", "阴阳两仪环", "寂灭轮回臂", "灵宝-轮回臂", "踏仙", "寂"},{"", "草绳腕带", "铁纹护腕", "冰魄玉环", "玄火缠丝扣", "金乌焚天腕", "太阴锁灵环", "须弥太极腕", "造化寰宇腕", "玄天寂灭腕", "灵宝-玄天腕", "寂世", "世"},{"", "生锈短刀", "青锋短匕", "玄铁重剑", "赤霄斩月刀", "九幽噬魂枪", "太虚星辰剑", "破界碎空戟", "混沌太虚剑", "轮回灭世戟", "灵宝-灭世戟", "万道", "墟"},{"", "聚灵珠", "琉璃钟", "三昧真火珠", "玄冰凝魂镜", "金乌炎阳珠", "太虚玄火钟", "周天星辰珠", "鸿蒙造化珠", "万象归墟镜", "灵宝-归墟镜", "太虚", "灵"}};strcpy_s(name, names[_type][_rare]);damage = getrand(lv * 14, lv * 14 + 10);HP = getrand(lv * 50, lv * 50 + 10);if (_type == 6){damage *= 1.3;HP /= 1.1;}if (_type == 7){damage /= 1.1;HP *= 1.3;}switch (rare){case Rblue: damage *= 1.05; HP *= 1.2; break;case Rpurple: damage *= 1.15; HP *= 1.35; break;case Rorange: damage *= 1.25; HP *= 1.65; break;case Rred: damage *= 1.4; HP *= 1.95; break;case Rgold: damage *= 1.5; HP *= 2.1; break;case Rlightblue: damage *= 1.6; HP *= 2.3; break;case Rrainbow: damage *= 1.7; HP *= 2.5; break;case RRrainbow: damage *= 1.8; HP *= 2.7; break;case Rblack: damage *= 2.0; HP *= 3.1; break;case RRblack: damage *= 2.2; HP *= 5.0; break;}if (_rare == 0){strcpy_s(name, type);HP = 0;damage = 0;}else{power = rare * 84 + lv * 104 + HP * 15 + damage * 45;}}
} E[15];int main()
{bool NewEquipment = false;short randtype = 0;int MHPnow = 10, MHP = 10, damage = 1;int _damage = 1, _power = 0;long long _HP = 0;long long HPnow = 100, HP = 100, power = 0;equipment equ;init();for (short i = 0; i < 8; i++){_HP += E[i].HP;_damage += E[i].damage;_power += E[i].power;}HP = _HP + 100;HPnow = HP;power = _power;damage = _damage;MHP = G * 2 * G;if (G >= 100) MHP = max(G * 1.5 * G, 100 * 2 * 100);else if (G >= 150) MHP = max(G * 1.3 * G, G * 1.5 * G);else if (G >= 200) MHP = max(G * G, G * 1.3 * G);else if (G >= 250) MHP = max(G * G / 1.1, G * G);else if (G >= 300) MHP = max(G * G / 1.3, G * G / 1.1);else MHP = max(G * G / 1.5, G * G / 1.3);if (MHP <= 5) MHP = 5;MHPnow = MHP;bool upgrade = false;int UpgradeTimes = 10, UpgradeTimes2 = 10;UpgradeTimes = TreeLV * 10 + (TreeLV - 1) * 15;UpgradeTimes2 = UpgradeTimes;while (1) {while (HPnow > 0){for (short i = 0; i < 8; i++){E[i].ecolor();gotoxy(4, 2 + i * 2);printf("[%d级]%s  ", E[i].lv, E[i].name);}color(0, 0, 0);if (Red > 0 || Orange > 0 || Purple > 0){gotoxy(100, 2); ecolor(1);printf("凡品概率 %d%%  ", Grey);gotoxy(100, 4); ecolor(2);printf("下品概率 %d%%  ", Green);gotoxy(100, 6); ecolor(3);printf("中品概率 %d%%  ", Blue);gotoxy(100, 8); ecolor(4);printf("上品概率 %d%%  ", Purple);gotoxy(100, 10); ecolor(5);printf("极品概率 %d%%  ", Orange);gotoxy(100, 12); ecolor(6);printf("仙品概率 %d%%  ", Red);gotoxy(100, 14); ecolor(7);printf("完美概率 %d%%  ", Gold);gotoxy(100, 16); ecolor(8);printf("先天概率 %d%%  ", Lightblue);gotoxy(100, 18); ecolor(9);printf("至宝概率 %.2f%%  ", Rainbow);}else{gotoxy(100, 2); ecolor(6);printf("仙品概率 %d%%  ", Red);gotoxy(100, 4); ecolor(7);printf("完美概率 %d%%  ", Gold);gotoxy(100, 6); ecolor(8);printf("先天概率 %d%%  ", Lightblue);gotoxy(100, 8); ecolor(9);printf("至宝概率 %.2f%%  ", Rainbow);gotoxy(100, 10); ecolor(10);printf("灵宝概率 %.2f%%  ", Rainbow2);gotoxy(100, 12); ecolor(11);printf("神器概率 %.2f%%  ", Black);gotoxy(100, 14); ecolor(12);printf("仙器概率 %.2f%%  ", Black2);}color(0, 0, 0);gotoxy(4, 18);printf("血量:%d  ", HP);gotoxy(4, 19);printf("攻击:%d  ", damage);gotoxy(4, 20);if (Lv < 10) printf("练气期");else if (Lv < 20) printf("筑基期");else if (Lv < 30) printf("金丹期");else if (Lv < 40) printf("元婴期");else if (Lv < 50) printf("化神期");else if (Lv < 60) printf("炼虚期");else if (Lv < 70) printf("合体期");else if (Lv < 80) printf("大乘期");else if (Lv < 90) printf("渡劫期");else if (Lv < 100) printf("金仙期");else if (Lv < 110) printf("真仙期");else if (Lv < 120) printf("地仙期");else if (Lv < 130) printf("天仙期");else  printf("玄仙期%d级", (Lv - 130) / 10 + 1);printf("%d阶 (%d/%d)      ", Lv % 10 + 1, Exp, Exp2);gotoxy(4, 21);printf("功力:%lld  ", power + (Lv - 1) * 203);gotoxy(4, 22);printf("灵石:%lld  ", SpiritStone);gotoxy(4, 23);printf("仙树等级:%d", TreeLV);if (!(SpiritStone >= TreeLV * 322 + (TreeLV - 1) * 638)){gotoxy(4, 24);color(90, 90, 90);if (TreeLV < 87)printf("(需%d灵石可升级)  ", TreeLV * 322 + (TreeLV - 1) * 638);}else{if (upgrade == false){gotoxy(4, 24);color(0, 153, 0);if (TreeLV < 87){printf("(可升级 按F键升级)     ");if (GetAsyncKeyState('F') & 0x8000){upgrade = true;SpiritStone -= TreeLV * 322 + (TreeLV - 1) * 638;}}else{color(90, 90, 90);printf("已满级");}}else if (!(GetAsyncKeyState('F') & 0x8000)){if (UpgradeTimes <= 0){UpgradeTimes = TreeLV * 5 + UpgradeTimes2 / 2 + (TreeLV - 1) * 10;UpgradeTimes2 = UpgradeTimes;upgrade = false;gotoxy(4, 24);printf("                                             ");TreeUP();TreeLV++;}else{gotoxy(4, 24);color(0, 0, 0);printf("正在升级 需%d秒 按P花费%d灵石立刻升级", UpgradeTimes, UpgradeTimes * 50);if (times % 30 == 0){if (upgrade) UpgradeTimes--;}if (GetAsyncKeyState('P') & 0x8000){if (SpiritStone >= UpgradeTimes * 50){SpiritStone -= UpgradeTimes * 50;UpgradeTimes = 0;}else{SpiritStone = 0;UpgradeTimes -= SpiritStone / 50;}}}}}color(0, 0, 0);gotoxy(58, 1);printf("关卡 %d", G);color(0, 153, 0);gotoxy(50, 8); printf("我");gotoxy(44, 9);printf("HP:%d / %d   ", HPnow, HP);color(153, 0, 0);gotoxy(72, 8); printf("敌");gotoxy(66, 9);printf("HP:%d / %d   ", MHPnow, MHP);if (NewEquipment == true){equ.ecolor();gotoxy(45, 12);printf("获得新装备:[%d级]%s", equ.lv, equ.name);gotoxy(45, 13);printf("功力 %d(%+d)", equ.power, equ.power - E[randtype].power);gotoxy(45, 14);printf("血量 %d(%+d)", equ.HP, equ.HP - E[randtype].HP);gotoxy(45, 15);printf("伤害 %d(%+d)", equ.damage, equ.damage - E[randtype].damage);gotoxy(45, 16);printf("替换并分解原装备(y) 分解(n)", equ.damage, equ.damage - E[randtype].damage);if (GetAsyncKeyState('Y') & 0x8000){Exp = Exp + 10 + equ.power / 1000;SpiritStone += E[randtype].power / 10;E[randtype] = equ;NewEquipment = false;long long _HP = 100;int _damage = 1;int _power = 0;for (short i = 0; i < 8; i++){_HP += E[i].HP;_damage += E[i].damage;_power += E[i].power;}HP = _HP + 100;HPnow = HP;power = _power;damage = _damage;SaveRecord();system("cls");}else if (GetAsyncKeyState('N') & 0x8000){Exp = Exp + 10 + E[randtype].power / 1000;SpiritStone += equ.power / 10;NewEquipment = false;system("cls");HPnow = HP;}}if (NewEquipment == false){if (times % 30 == 1){color(240, 240, 240);gotoxy(72, 8); printf("敌");Exp++;}if (times % 30 == 16){color(240, 240, 240);gotoxy(50, 8); printf("我");Exp++;}if (times % 15 == 0){if (times % 30 == 15){HPnow -= G * G / 10;color(240, 240, 240);gotoxy(50, 8); printf("我");}else{MHPnow -= damage;color(240, 240, 240);gotoxy(72, 8); printf("敌");}}if (Exp >= Exp2){Exp -= Exp2;Exp2 = Exp2 += Lv * 5;Lv++;if (Lv % 10 == 0) Exp2 -= 100;}}if (MHPnow <= 0){Sleep(200);G++;MHP = G * 2 * G;if (G >= 100) MHP = max(G * 1.5 * G, 100 * 2 * 100);else if (G >= 150) MHP = max(G * 1.3 * G, G * 1.5 * G);else if (G >= 200) MHP = max(G * G, G * 1.3 * G);else if (G >= 250) MHP = max(G * G / 1.1, G * G);else if (G >= 300) MHP = max(G * G / 1.3, G * G / 1.1);else MHP = max(G * G / 1.5, G * G / 1.3);if (MHP <= 5) MHP = 5;MHPnow = MHP;randtype = getrand(0, 7);int EquipmentRand = getrand(1, 100);if (EquipmentRand <= Grey)equ.init(Rgrey, randtype);else if (EquipmentRand - Grey <= Green)equ.init(Rgreen, randtype);else if (EquipmentRand - Grey - Green <= Blue)equ.init(Rblue, randtype);else if (EquipmentRand - Grey - Green - Blue <= Purple)equ.init(Rpurple, randtype);else if (EquipmentRand - Grey - Green - Blue - Purple <= Orange)equ.init(Rorange, randtype);else if (EquipmentRand - Green - Blue - Purple - Orange <= Red)equ.init(Rred, randtype);else if (EquipmentRand - Blue - Purple - Orange - Red <= Gold)equ.init(Rgold, randtype);else if (EquipmentRand - Purple - Orange - Red - Gold <= Lightblue)equ.init(Rlightblue, randtype);else if (EquipmentRand - Orange - Red - Gold - Lightblue <= Rainbow)equ.init(Rrainbow, randtype);else if (EquipmentRand - Red - Gold - Lightblue - Rainbow <= Rainbow2)equ.init(RRrainbow, randtype);else if (EquipmentRand - Gold - Lightblue - Rainbow - Rainbow2 <= Black)equ.init(Rblack, randtype);else if (EquipmentRand - Gold - Lightblue - Rainbow - Rainbow2 - Black <= Black2)equ.init(RRblack, randtype);if (G == 51){strcpy_s(equ.type, "");equ.rare = Rorange;equ.HP = 9999;equ.damage = 2999;}NewEquipment = true;system("cls");}times++;if (times == 3000) times = 0;Sleep(20);}init();for (short i = 0; i < 8; i++){_HP += E[i].HP;_damage += E[i].damage;_power += E[i].power;}HP = _HP + 100;HPnow = HP;power = _power;damage = _damage;MHPnow = MHP;system("cls");gotoxy(58, 4);color(0, 0, 0);printf("GA"); Sleep(1000);printf("ME"); Sleep(1000);printf(" OV"); Sleep(1000);printf("ER"); Sleep(1000);}
}void init()
{srand(time(0));for (short i = 0; i < 8; i++){E[i].init(0, i);}LoadRecord();system("color F0");hide_cursor();Lv++;
}int getrand(int min, int max)
{return (rand() % (max - min + 1)) + min;
}void gotoxy(int x, int y)
{COORD c;c.X = x;c.Y = y;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}void hide_cursor()
{HANDLE h_GAME = GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_CURSOR_INFO cursor_info;GetConsoleCursorInfo(h_GAME, &cursor_info);cursor_info.bVisible = false;SetConsoleCursorInfo(h_GAME, &cursor_info);
}void color(int r, int g, int b)
{wprintf(L"\x1b[38;2;%d;%d;%dm", r, g, b);
}
void color2(COLORRGB c)
{wprintf(L"\x1b[38;2;%d;%d;%dm", c.r, c.g, c.b);
}
void TreeUP()
{if (Grey > 0){if (Grey > 3){Grey -= 6;Green += 2;Blue += 2;Purple += 2;}else{Grey -= 3;Green += 1;Blue += 1;Purple += 1;}}else if (Green > 0){Green -= 6;Blue += 2;Purple += 2;Orange += 2;}else if (Blue > 0){Blue -= 5;Purple++;Orange += 2;Red += 2;}else if (Purple > 0){if (Purple > 2){Purple -= 4;Red += 2;Gold += 2;}else{Purple -= 2;Red += 1;Gold += 1;}}else if (Orange > 0){if (Purple > 2){Orange -= 4;Gold += 2;Lightblue += 2;}else{Orange -= 2;Gold += 1;Lightblue += 1;}}else if (Red > 0){if (Red == 43){Red -= 3;Rainbow += 3;}else{Red -= 5;Gold += 1;Lightblue += 2;Rainbow += 2;}}else if (Gold > 0){Gold -= 6;Lightblue += 2;Rainbow += 3.5;Rainbow2 += 0.5;}else if (Lightblue > 0){Lightblue -= 7;Rainbow += 5.2;Rainbow2 += 1.3;Black += 0.4;Black2 += 0.1;}else if (Rainbow > 0){Rainbow -= 8.34;Rainbow2 += 2.34;Black += 4;Black2 += 2;if (TreeLV == 86) Rainbow = 0;}
}
// 文件操作:保存记录
void SaveRecord() {ofstream file("equipment.save");for (short i = 0; i < 8; i++){file << E[i].HP << " ";file << E[i].damage << " ";file << E[i].lv << " ";file << E[i].rare << " ";file << E[i].power << endl;file << E[i].type << " ";file << E[i].name << endl;}ofstream file2("Tree.save");file2 << Grey << " ";file2 << Green << " ";file2 << Blue << " ";file2 << Purple << " ";file2 << Orange << " ";file2 << Red << " ";file2 << Gold << " ";file2 << Lightblue << " ";file2 << Rainbow << " ";file2 << Rainbow2 << " ";file2 << Black << " ";file2 << Black2 << " ";file2 << Lv << " ";file2 << Exp << " ";file2 << Exp2 << " ";file2 << TreeLV << " ";file2 << SpiritStone << " ";file2 << G << " ";
}// 文件操作:加载记录
void LoadRecord() {ifstream file("equipment.save");if (file) {for (short i = 0; i < 8; i++){file >> E[i].HP;file >> E[i].damage;file >> E[i].lv;file >> E[i].rare;file >> E[i].power;file >> E[i].type;file >> E[i].name;}}ifstream file2("Tree.save");if (file2){file2 >> Grey;file2 >> Green;file2 >> Blue;file2 >> Purple;file2 >> Orange;file2 >> Red;file2 >> Gold;file2 >> Lightblue;file2 >> Rainbow;file2 >> Rainbow2;file2 >> Black;file2 >> Black2;file2 >> Lv;file2 >> Exp;file2 >> Exp2;file2 >> TreeLV;file2 >> SpiritStone;file2 >> G;}
}COLORRGB HSLtoRGB(float h, float s, float l) {COLORRGB C;float r, g, b;if (s == 0) {r = g = b = static_cast<int>(l * 255);}else {float m2;if (l < 0.5) {m2 = l * (1 + s);}else {m2 = l + s - l * s;}float m1 = 2 * l - m2;float t_r = h / 360.0f + 1.0f / 3.0f;float t_g = h / 360.0f;float t_b = h / 360.0f - 1.0f / 3.0f;std::vector<float> color_list = { t_r, t_g, t_b };for (float& color : color_list) {if (color < 0) color += 1.0f;if (color > 1) color -= 1.0f;}std::vector<float> rgb_values;for (float t : color_list) {float c_i;if (t < 1.0f / 6.0f) {c_i = m1 + (m2 - m1) * 6.0f * t;}else if (t < 3.0f / 6.0f) {c_i = m2;}else if (t < 4.0f / 6.0f) {c_i = m1 + (m2 - m1) * (4.0f - 6.0f * t);}else {c_i = m1;}rgb_values.push_back(c_i);}r = static_cast<int>(rgb_values[0] * 255);g = static_cast<int>(rgb_values[1] * 255);b = static_cast<int>(rgb_values[2] * 255);}C.r = r;C.g = g;C.b = b;return C;
}void ecolor(short rare)
{switch (rare){case Rgrey: color(140, 140, 140); break;case Rgreen: color(0, 153, 0); break;case Rblue: color(0, 0, 153); break;case Rpurple: color(102, 0, 204); break;case Rorange: color(255, 153, 51); break;case Rred:color(175 + (times / 2) % 80, 0, 0);if ((times / 2) % 160 >= 80) color(255 - (times / 2) % 80, 0, 0);break;case Rgold:color(220 + (times / 3) % 20, 220 + (times / 3) % 20, 0);if ((times / 3) % 40 >= 20) color(240 - (times / 3) % 20, 240 - (times / 3) % 20, 0);break;case Rlightblue:{float H = 211;float S = 1;if (times % 200 >= 100) color2(HSLtoRGB(H, S, 0.85f - float(times % 100) / 500));else color2(HSLtoRGB(H, S, 0.65f + float(times % 100) / 500));break;}case Rrainbow:{float S = 1;float L = 0.5f;color2(HSLtoRGB(times % 720 / 2, S, L));break;}case RRrainbow:{float S = 1;float L = 0.5f;color2(HSLtoRGB(times % 360, S, L));break;}case Rblack:{float H = 0;float S = 0;if (times % 200 >= 100){color2(HSLtoRGB(H, S, 0.25f - float(times % 100) / 400));}else{color2(HSLtoRGB(H, S, float(times % 100) / 400));}break;}case RRblack:{float H = 0;float S = 0;if (times % 200 >= 100){color2(HSLtoRGB(H, S, 0.5f - float(times % 100) / 200));}else{color2(HSLtoRGB(H, S, float(times % 100) / 200));}break;}default: color(245, 245, 245);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/73609.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Docker安装部署RabbitMQ

Docker安装部署RabbitMQ 本文介绍了如何在Linux&#xff08;CentOS 7&#xff09;系统环境下的Docker上安装部署RabbitMQ的详细过程。 目录 Docker安装部署RabbitMQ一、环境准备1.Linux环境2.Docker3.停止并移除现有的 RabbitMQ 镜像和容器 二、安装部署RabbitMQ1.拉取 RabbitM…

线性代数(1)用 excel 计算鸡兔同笼

线性代数excel计算鸡兔同笼 案例&#xff1a;鸡兔同笼问题的三种解法&#xff08;递进式教学&#xff09;一、问题描述二、方程式解法&#xff08;基础版&#xff09;步骤解析 三、线性代数解法&#xff08;进阶版&#xff09;1. 方程组转化为矩阵形式2. 矩阵求解&#xff08;逆…

【网络】简单的 Web 服务器架构解析,包含多个服务和反向代理的配置,及非反向代理配置

这张图片描述了一个简单的 Web 服务器架构&#xff0c;包含多个服务和反向代理的配置。以下是对每个部分的详细解释&#xff0c;帮助你理解其中的技术内容&#xff1a; 1. Web Server: ifn666.com 这是你的主域名&#xff08;ifn666.com&#xff09;&#xff0c;所有服务都通过…

​​​​​​​大语言模型安全风险分析及相关解决方案

大语言模型的安全风险可以从多个维度进行分类。 从输入输出的角度来看,存在提示注入、不安全输出处理、恶意内容生成和幻觉错误等风险; 从数据层面来看,训练数据中毒、敏感信息泄露和模型反演攻击是主要威胁; 模型自身则面临拒绝服务和盗窃的风险; 供应链和插件的不安全引…

贪心算法——c#

贪心算法通俗解释 贪心算法是一种"每一步都选择当前最优解"的算法策略。它不关心全局是否最优&#xff0c;而是通过局部最优的累积来逼近最终解。优点是简单高效&#xff0c;缺点是可能无法得到全局最优解。 一句话秒懂 自动售货机找零钱&#xff1a;用最少数量的…

【计算机网络】2物理层

物理层任务:实现相邻节点之间比特(或)的传输 1.通信基础 1.1.基本概念 1.1.1.信源,信宿,信道,数据,信号 数据通信系统主要划分为信源、信道、信宿三部分。 信源:产生和发送数据的源头。 信宿:接收数据的终点。 信道:信号的传输介质。 数据和信号都有模拟或数字…

deepseek GRPO算法保姆级讲解(数学原理+源码解析+案例实战)

文章目录 什么是GRPO群组形成(Group Formation):让大模型创建多种解决方案偏好学习(Preference Learning)&#xff1a;让大模型理解何为好的解答组内相对优势 优化(optimization): 让大模型从经验中学习(learning from experience)目标函数 GRPO算法的伪码表示GRPO算法的局限与…

Google Cloud Run 如何实现无服务器(Serverless)部署?

DDoS&#xff08;分布式拒绝服务&#xff09;攻击是黑客常用的一种手段&#xff0c;通过大量恶意流量冲击服务器&#xff0c;导致网站无法访问。针对这种威胁&#xff0c;Cloudflare提供了一整套防护措施&#xff0c;包括流量过滤、速率限制、防火墙规则等&#xff0c;使网站能…

QuickAPI 和 DBAPI 谁更香?SQL生成API工具的硬核对比(一)

最近低代码开发火得不行&#xff0c;尤其是能把数据库秒变API的工具&#xff0c;简直是开发者的救星。今天咱就聊聊两款国内玩家&#xff1a;QuickAPI&#xff08;麦聪软件搞出来的低代码神器&#xff09;和 DBAPI&#xff08;开源社区的硬核作品&#xff09;。这两货都能靠SQL…

网络通信(传输层协议:TCP/IP ,UDP):

Socket是对网络中不同主机上的应用进程之间进行双向通信的端点的抽象。一个套接字就是网络上进程通信的一端&#xff0c;提供了应用层进程利用网络协议交换数据的机制。 网络协议&#xff1a;一台电脑的数据怎么传递给另一台电脑&#xff0c;是由网络协议来规定的 端口号&#…

DeepSeek进阶应用(二):结合Kimi制作PPT(双AI协作教程)

&#x1f31f;引言&#xff1a; DeepSeek作为国产AI大模型&#xff0c;以强大的逻辑推理和结构化内容生成能力著称&#xff0c;擅长根据用户需求生成PPT大纲或Markdown文本&#xff1b;Kimi的PPT助手则能解析结构化内容并套用模板快速生成美观的PPT&#xff0c;两者结合实现“内…

卷积神经网络(知识点)

一、为了使特征图变小&#xff1a; 由两种方法&#xff1a;1.增大步长&#xff1a;卷积的时候不是一次一步&#xff0c;而是一次多步&#xff0c;类似一张图片&#xff0c;在原来的像素基础上&#xff0c;每隔一个取一个像素点。 其中S就是步长 注意&#xff1a;扩大步长不经…

考研系列-408真题计算机网络篇(18-23)

写在前面 此文章是本人在备考过程中408真题计算机网络部分&#xff08;2018年-2023年&#xff09;的易错题及相应的知识点整理&#xff0c;后期复习也常常用到&#xff0c;对于知识提炼归纳理解起到了很大的作用&#xff0c;分享出来希望帮助到大家~ # 2018 1.停止-等待协议的…

六种最新优化算法(TOC、MSO、AE、DOA、GOA、OX)求解多个无人机协同路径规划(可以自定义无人机数量及起始点),MATLAB代码

一、算法简介 &#xff08;一&#xff09;阿尔法进化&#xff08;Alpha Evolution&#xff0c;AE&#xff09;算法 阿尔法进化&#xff08;Alpha Evolution&#xff0c;AE&#xff09;算法是2024年提出的一种新型进化算法&#xff0c;其核心在于通过自适应基向量和随机步长的…

上传本地项目到GitHub

一、在GitHub上创建仓库 1.点击右上角头像–>点击Your repositories 2.点击New 3.创建仓库 网址复制一下&#xff0c;在后面git上传时会用到 二、打开Git Bash 1.cd 进入项目所在路径 2.输入git init 在当前项目的目录中生成本地的git管理&#xff08;当前目录下出现.…

14.使用各种读写包操作 Excel 文件:辅助模块

一 各种读写包 这些是 pandas 在底层使用的各种读写包。无须安装 pandas&#xff0c;直接使用这些读写包就能够读写 Excel 工作簿。可以尽可能地使用 pandas 来解决这类问题&#xff0c;只在 pandas 没有提供你所需要的功能时才用到读写包。 表中没有 xlwings &#xff0c;因为…

ubuntu ollama+dify实践

安装ollama 官网的指令太慢了&#xff0c;使用以下指令加速&#xff1a; export OLLAMA_MIRROR"https://ghproxy.cn/https://github.com/ollama/ollama/releases/latest/download" curl -fsSL https://ollama.com/install.sh | sed "s|https://ollama.com/dow…

spring boot+mybaits多条件模糊查询和分页查询

我们首先写一下多条件的模糊查询&#xff0c;首先在controller里面写一个接口&#xff0c;进行传参&#xff0c;我们这里要注意&#xff0c;之前写修改和增加的时候用的注解都是RequestBody,也就是说&#xff01;前端传过来一个json&#xff0c;数组也行&#xff0c;然后我们后…

HarmonyOS NEXT - 电商App实例四(登录界面)

登录界面是用户进入App的第一步&#xff0c;因此需要简洁明了&#xff0c;同时保持品牌风格的一致性。如&#xff1a;顶部区域为品牌LOGO展示&#xff0c;增加品牌识别度&#xff1b;中间区域为登录表单&#xff0c;包含输入框和按钮&#xff1b;底部区域为其他登录方式、注册入…

图解多头注意力机制:维度变化一镜到底

目录 一、多头注意力机制概述二、代码实现1. pyTorch 实现2. tensorFlow实现 三、维度变化全流程详解1. 参数设定2. 维度变化流程图3. 关键步骤维度变化 四、关键实现细节解析1. 多头拆分与合并2. 注意力分数计算3. 掩码处理技巧 五、完整运行示例六、总结与常见问题1. 核心优势…