编写一个俄罗斯方块

编写俄罗斯方块 思路。

1、创建容器数组,方块,

2、下落,左右移动,旋转,判断结束,消除。

 定义一个20行10列的数组表示游戏区。初始这个数组里用0填充,1表示有一个方块,2表示该方块固定了,

然后随机出一个方块,操作左右转,触底变2后,再随机下一个方块,循环直到判定结束。

<template><div><div class="gamebox"><div class="table"><ul><li v-for="item in elsStore.gameArray">{{ item }}</li></ul></div><div class="next"><ul><li v-for="item in elsStore.nextArray">{{ item }}</li></ul><p>消除:{{ elsStore.score }}</p></div></div><div class="toolbar"><div><el-button type="success" @click="gameStart">开始</el-button><el-button type="success" @click="gameReset">重置</el-button></div></div></div>
</template><script setup lang="ts">
import useElsStore from '@/stores/els';
const elsStore = useElsStore();
elsStore.resetTable
//     // I:一次最多消除四层
//     // L(左右):最多消除三层,或消除二层
//     // O:消除一至二层
//     // S(左右):最多二层,容易造成孔洞
//     // Z(左右):最多二层,容易造成孔洞
//     // T:最多二层
let intervalDown: NodeJS.Timer;
const gameStart = () => {//  开始游戏  当前游戏中,需要先重置游戏,// 放置next,并开始游戏逻辑elsStore.randNext;intervalDown = setInterval(startDown, 1000);}
const gameReset = () => {clearInterval(intervalDown);elsStore.resetTable}const startDown = () => {console.log("down....");}</script><style scoped lang="scss">
.gamebox {display: flex;justify-content: flex-start;.next {margin-left: 20px;p {margin-top: 20px;}}
}.toolbar {display: flex;width: 100vw;justify-content: center;margin-top: 10px;}
</style> 

//定义关于counter的store
import { defineStore } from 'pinia'
import { enumStoreName } from "../index";
import { ElsTable } from '@/api/room/type';//defineStore 是返回一个函数 函数命名最好有use前缀,根据函数来进行下一步操作
const useElsStore = defineStore(enumStoreName.elsStore, {state: (): ElsTable => {return {// 主要区域gameArray: new Array<Array<number>>(),// 下一个图形nextArray: new Array<Array<number>>(),// 定义俄罗斯方块游戏区域大小rows: 20, columns: 10,// 对应值 0 空,1有活动方块 , 2有固定方块value: 0,// 游戏分数score: 0}},actions: {// 初始化界面resetTable() {this.gameArray = new Array<Array<number>>();this.nextArray = new Array<Array<number>>();// reset mainfor (let i = 0; i < this.rows; i++) {this.gameArray.push(new Array<number>());}for (let i = 0; i < this.gameArray.length; i++) {for (let j = 0; j < this.columns; j++) {this.gameArray[i].push(this.value);}}// reset nextfor (let i = 0; i < 4; i++) {this.nextArray.push(new Array<number>());}for (let i = 0; i < this.nextArray.length; i++) {for (let j = 0; j < 4; j++) {this.nextArray[i].push(this.value);}}},randNext(){}},getters: {getAddress(): string {return ""},},persist: {key: enumStoreName.elsStore,storage: localStorage,},
})export default useElsStore

 

第二阶段:改版后的情况

1、编写ui部分

 <div><div class="gamebox"><div class="table"><ul><li v-for="item in elsStore.els.getShowPlate()  "><span v-for="x in item.split(',')"><div class="box" v-if="x != '0'":style="'background-color:' + elsStore.els.next_plate.color + ';'"></div></span></li></ul></div><div class="next"><div class="top"><ul><li v-for="item in elsStore.els.next_plate.currentString().split('@')"><span v-for="x in item.split(',')"><div class="box" v-if="x != '0'":style="'background-color:' + elsStore.els.next_plate.color + ';'"></div></span></li></ul><p>消除: {{ elsStore.els.score }}</p></div><div class="bottom"><div class="btn"><el-button type="success" @click="gameStart">开始</el-button><el-button type="success" @click="gameReset">重置</el-button></div></div></div></div><div class="toolbar"><div class="btn"><el-button type="success" @click="leftClick" :icon="ArrowLeftBold">左移</el-button><el-button type="success" @click="rightClick" :icon="ArrowRightBold">右移</el-button><el-button type="success" @click="rotateClick" :icon="Refresh">旋转</el-button><el-button type="success" @click="downClick" :icon="Refresh">下落</el-button></div> </div> </div>

 


<style scoped lang="scss">
.gamebox {display: flex;justify-content: flex-start;.table {ul {width: 60vw;border: solid 1px;margin: 20px;li {display: flex;width: 60vw;span {width: 6vw;height: 6vw;.box {width: 100%;height: 100%;border: 1px solid #000;}}}}}.next {display: flex;flex-direction: column;justify-content: space-between;align-items: center;margin-top: 40px;.top {ul {width: 24vw;li {display: flex;width: 24vw;span {width: 6vw;height: 6vw;border: solid 1px;.box {width: 100%;height: 100%;}}}}}p {margin-top: 20px;}.bottom {margin-bottom: 148px;.btn {display: flex;flex-direction: column;align-items: flex-end;justify-content: space-around;button {margin-bottom: 5px;}}}}
}.toolbar {display: flex;width: 100vw;justify-content: center;margin-top: 10px;flex-direction: column;.btn {display: flex;justify-content: center;}}.el-button {height: 70px;
}
</style> 

主要逻辑部分


import { ArrowLeftBold, Refresh, ArrowRightBold } from '@element-plus/icons-vue'
import { GameControl } from "./class/GameControl";
import { reactive  } from "vue";const elsStore = reactive({els: new GameControl()
}) const rotateClick = () => {console.log("向右旋转");elsStore.els.rotate()
}
const leftClick = () => {elsStore.els.current_plate.position.x =(elsStore.els.current_plate.position.x > 0) ? elsStore.els.current_plate.position.x - 1 : 0}
const rightClick = () => {elsStore.els.current_plate.position.x =(elsStore.els.current_plate.position.x + elsStore.els.current_plate.getPlateSize().width < 10)? elsStore.els.current_plate.position.x + 1 : elsStore.els.current_plate.position.x}
const downClick = () => {elsStore.els.current_plate.position.y += 1
}const timers = () => {console.log("游戏循环开始");// 检查当前盘是否有重叠的,因为最后一步是让动块下降一格。// 因此,如果最后一步没有重叠,那么说明盘已经到底了,游戏结束// console.log('currentBox' + elsStore.els.current_plate.name, elsStore.els.current_plate.position.y);if (!elsStore.els.checkShowPlateIsOK()) {console.log("游戏结束");elsStore.els.started = false;return false}// 在Main盘面合法的情况下,需要检查即将触底或碰撞,就触发Lock更新if (elsStore.els.willPong()) {// console.log("====================Lock================");elsStore.els.lock_plate = elsStore.els.getShowPlate().join("@")// 消除elsStore.els.checkAndClear();// 负责下一块给当前动块,并随机一个下一块。elsStore.els.newCurrentPlate();} else {elsStore.els.current_plate.position.y += 1;}setTimeout(() => {if (elsStore.els.started) { timers(); }}, 500);};const gameStart = () => {console.log('游戏开始');if (elsStore.els.started) {return false;}elsStore.els.next_plate = elsStore.els.newRndPlate()elsStore.els.started = truetimers();}const gameReset = () => {console.log('重置游戏');elsStore.els = new GameControl()elsStore.els.started = false}

可以看到主要是循环部分。然后就是调gameControl部分

 
import { Config } from "../config";
import { Plate } from "./Plate";export class GameControl {next_plate: Plate;current_plate: Plate;lock_plate: string;started: boolean;score: number;constructor() {this.next_plate = this.newRndPlate()this.current_plate = this.copyNextToCurrent();this.lock_plate = Config.defuaultLockPlatethis.started = falsethis.score = 0this.init()}init() {// 初始化游戏 console.log("初始化游戏");// 显示一个等待方块,并等待用户按下开始按钮。 }// 生成一个随机盘子newRndPlate() {return new Plate(Plate.PlateType[Math.floor(Math.random() * 6)]);}// 复制下一个盘子到当前盘子private copyNextToCurrent(): Plate {let plate = new Plate(this.next_plate.name);plate.position.x = 3plate.position.y = 0return plate}// 合并盘子 ,用给定的Plate和Lock进行合并,不用检查是否重叠private margePlate(plate: Plate) {let tmp_plate = plate.currentStringMax().split("@");let lockList = this.lock_plate.split("@");let newLockList: string[] = []// console.log({ tmp_plate, lockList, newLockList });// 跟lock合并for (let i = 0; i < lockList.length; i++) {let lockListi = lockList[i].split(",");let tmp_platei = tmp_plate[i].split(",");let newLockLine: string[] = []for (let j = 0; j < lockListi.length; j++) {newLockLine.push("" + eval(lockListi[j] + '+' + tmp_platei[j]))}newLockList.push(newLockLine.join(","))}// console.log({ newLockList });return newLockList;}// 检查给定数组是否有重叠private checkMainOK(main: string[]): boolean {for (let i = 0; i < main.length; i++) {const boxList = main[i].split(",")for (let j = 0; j < boxList.length; j++) {if (eval(boxList[j]) > 1) {return false;}}}return true;}willPong(): boolean {let tmp_plate = new Plate(this.current_plate.name);tmp_plate.position.x = this.current_plate.position.xtmp_plate.position.y = this.current_plate.position.y + 1tmp_plate.direction = this.current_plate.directionlet height = tmp_plate.getPlateSize().height;if (tmp_plate.position.y + height > 20) {return true}let newLockList = this.margePlate(tmp_plate);return !this.checkMainOK(newLockList);}getShowPlate(): string[] {if (!this.started) {return this.lock_plate.split("@")}// console.log("====================");// console.log({ current_plate:this.current_plate,lock_plate:this.lock_plate});let newLockList = this.margePlate(this.current_plate);// console.log({ newLockList});// // 跟lock合并// for (let i = 0; i < lockList.length; i++) {//     let lockListi = lockList[i].split(",");//     let tmp_platei = tmp_plate[i].split(",");//     let newLockLine: string[] = []//     for (let j = 0; j < lockListi.length; j++) {//         newLockLine.push("" + eval(lockListi[j] + '+' + tmp_platei[j]))//     }//     newLockList.push(newLockLine.join(","))// }// for (let i = 0; i < lockList.length; i++) {//     if (i < tmp_plate.length) {//         let lockListi = lockList[i].split(",");//         let tmp_platei = tmp_plate[i].split(",");//         let newLockLine: string[] = []//         for (let j = 0; j < lockListi.length; j++) {//             newLockLine.push("" + eval(lockListi[j] + '+' + tmp_platei[j]))//         }//         newLockList.push(newLockLine.join(","))//     } else {//         let lockListi = lockList[i].split(",");//         let newLockLine: string[] = []//         for (let j = 0; j < lockListi.length; j++) {//             newLockLine.push(lockListi[j])//         }//         newLockList.push(newLockLine.join(","))//     }// }return newLockList;}// 检查getShowPlate是否有大于1的块checkShowPlateIsOK() {return this.checkMainOK(this.getShowPlate());}//   newCurrentPlate 函数newCurrentPlate() {this.current_plate = this.copyNextToCurrent();this.next_plate = this.newRndPlate()}// 旋转后的dirrotate() {// 如果超界或重叠就不让旋转 仅下部分超界就不让。this.current_plate.direction = (this.current_plate.direction + 1) % 4if (this.current_plate.position.y + this.current_plate.getPlateSize().height > 20 || (!this.checkShowPlateIsOK())) {this.current_plate.direction = (this.current_plate.direction - 1) % 4}}// 消除checkAndClear() {// 更新locklet lockList = this.lock_plate.split("@");let tmpList:string[] = []lockList.forEach((item ) => {if(item!="1,1,1,1,1,1,1,1,1,1"){tmpList.push(item)}});for (let index = 0; index < 20-tmpList.length; index++) {this.score ++tmpList = ['0,0,0,0,0,0,0,0,0,0'].concat(tmpList)}this.lock_plate = tmpList.join("@");}}

最后就是2个小类

export class Box {color: string;icon: string;disabled: boolean;constructor(color: string     ) { this.color = color; this.icon = "Grid"; this.disabled = true; } }
const  defuaultLockPlate: string = "0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0@0,0,0,0,0,0,0,0,0,0"; export const  Config =  {defuaultLockPlate}

 

import { Box } from "./Box";interface Pos {x: number;y: number;
}
export class Plate extends Box {// I:一次最多消除四层  (状态横竖2种)// L(左):L最多消除三层,或消除二层  (状态横竖4种)// R(右):反L最多消除三层,或消除二层   (状态横竖4种)// O:消除一至二层  (状态1种)// S(左右):最多二层,容易造成孔洞  (状态横竖2种)// Z(左右):最多二层,容易造成孔洞 (状态横竖2种)// T:最多二层 (状态横竖4种)name: string;// 字符串数组arrString: string[];// currentString: string;// 位置position: Pos;// 方向direction: number;// 是否锁住lock: boolean;static PlateType = ["I", "L", "O", "S", "Z", "T"]constructor(name: string) {let colors = ["red", "yellow", "blue", "green", "purple", "orange"];switch (name) {case "I":super(colors[0]);this.name = name;this.arrString = ["0,0,0,0@1,1,1,1@0,0,0,0@0,0,0,0","0,1,0,0@0,1,0,0@0,1,0,0@0,1,0,0","0,0,0,0@1,1,1,1@0,0,0,0@0,0,0,0","0,1,0,0@0,1,0,0@0,1,0,0@0,1,0,0"]break;case "L":super(colors[1]);this.name = name;this.arrString = ["0,1,1,1@0,1,0,0@0,0,0,0@0,0,0,0","0,0,1,0@1,1,1,0@0,0,0,0@0,0,0,0","0,1,0,0@0,1,0,0@0,1,1,0@0,0,0,0","0,1,1,0@0,0,1,0@0,0,1,0@0,0,0,0"]break;case "O":super(colors[2]);this.name = name;this.arrString = ["0,1,1,0@0,1,1,0@0,0,0,0@0,0,0,0","0,1,1,0@0,1,1,0@0,0,0,0@0,0,0,0","0,1,1,0@0,1,1,0@0,0,0,0@0,0,0,0","0,1,1,0@0,1,1,0@0,0,0,0@0,0,0,0",]break;case "S":super(colors[3]);this.name = name;this.arrString = ["0,0,1,1@0,1,1,0@0,0,0,0@0,0,0,0","0,1,0,0@0,1,1,0@0,0,1,0@0,0,0,0","0,0,1,1@0,1,1,0@0,0,0,0@0,0,0,0","0,1,0,0@0,1,1,0@0,0,1,0@0,0,0,0"]break;case "Z":super(colors[4]);this.name = name;this.arrString = ["0,1,1,0@0,0,1,1@0,0,0,0@0,0,0,0","0,0,1,0@0,1,1,0@0,1,0,0@0,0,0,0","0,1,1,0@0,0,1,1@0,0,0,0@0,0,0,0","0,0,1,0@0,1,1,0@0,1,0,0@0,0,0,0"]break;default: //Tsuper(colors[5]);this.name = name;this.arrString = ["0,0,1,0@0,1,1,0@0,0,1,0@0,0,0,0","0,0,1,0@0,1,1,1@0,0,0,0@0,0,0,0","0,1,0,0@0,1,1,0@0,1,0,0@0,0,0,0","0,1,1,1@0,0,1,0@0,0,0,0@0,0,0,0"]break;}this.position = {x: -1,y: -1}this.direction = Math.floor(Math.random() * 4)this.lock = falseconsole.log('创建了一个' + this.name + ' 颜色:' + this.color + ' 方向:' + this.direction);}// 4*4大小public currentString(): string {return this.arrString[this.direction]}//  精简块的内容 最小 化块public currentStringMin(): string {let plateStr = this.arrString[this.direction]let plates: string[] = [];// 去掉多余的 行plateStr.split("@").forEach((item) => {if (eval(item.replace(/,/g, "+")) > 0) {plates.push(item);}});// 去掉多余的 列 就是裁剪前面的0和后面的0// 计算是块的valueCount 如果少了,就不能裁剪。const countPlateValue = (plates: string[]) => {let tmpPlateList = plates.map((item) => {const sum = item.split(",").reduce(function (prev, cur) {return eval(prev + "+" + cur);});return sum})return tmpPlateList.reduce(function (prev, cur) {return eval(prev + "+" + cur);});}// console.log("test value", countPlateValue(plates));// 裁剪前面的0 const cuxsuff = (plates: string[]): string[] => {if (plates[0].split(",").length == 1) return plates// 尝试裁剪 ,如果长度为1,就不用裁剪了let tmpPlateList: string[] = plates.map((item) => {let t = item.split(",")t.shift()return t.join(",")})if (countPlateValue(tmpPlateList) == countPlateValue(plates)) {return cuxsuff(tmpPlateList)} else {return plates}}// 裁剪后面的0const cuxdiff = (plates: string[]): string[] => {if (plates[0].split(",").length == 1) return plates// 尝试裁剪 ,如果长度为1,就不用裁剪了let tmpPlateList: string[] = plates.map((item) => {let t = item.split(",")t.pop()return t.join(",")})if (countPlateValue(tmpPlateList) == countPlateValue(plates)) {return cuxdiff(tmpPlateList)} else {return plates}}const remainingPlates = cuxdiff(cuxsuff(plates)).join("@");return remainingPlates;}// 格式化成 Mian大小 的块public currentStringMax(): string {let currentString = this.currentStringMin()  let maxY = 20 - this.getPlateSize().height;let maxX = 10 - this.getPlateSize().width;this.position.x = this.position.x >= maxX ? maxX : this.position.x;this.position.y = this.position.y >= maxY ? maxY : this.position.y;let x = this.position.xlet y = this.position.ylet tmpPlateList = currentString.split("@").map((item) => {let prefix: string[] = [];let suffix: string[] = [];for (let i = 0; i < x; i++) {prefix.push("0")}for (let i = 0; i < 10 - item.split(",").length - x; i++) {suffix.push("0")}return prefix.concat(item.split(",").concat(suffix)).join(",");});for (let index = 0; index < y; index++) {tmpPlateList = ['0,0,0,0,0,0,0,0,0,0'].concat(tmpPlateList)}for (let index = 0; index < 20 - y - currentString.split("@").length; index++) {tmpPlateList = tmpPlateList.concat(['0,0,0,0,0,0,0,0,0,0'])}return tmpPlateList.join("@")}// 获取长和高public getPlateSize(): { width: number; height: number; } {return {width: this.currentStringMin().split("@")[0].split(",").length,height: this.currentStringMin().split("@").length}}}

最后是完整的源码下  http s://gitcode.net/ldy889/game-els  项目删掉了一些没用的东西,只保留了核心代码,需要自己去除一些错误。比如修改路径,无效的引入。

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

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

相关文章

基于Java SpringBoot+vue+html 的地方美食系统(2.0版本)

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝30W,csdn、博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 文章目录 1 简介2 技术栈3 系统流程的分析3.1 用户管理的流程3.2个人中心管理流程3.3登录流程 4系统设计…

【BASH】回顾与知识点梳理(三十六)

【BASH】回顾与知识点梳理 三十六 三十六. 认识与分析登录档36.1 什么是登录档CentOS 7 登录档简易说明登录档的重要性Linux 常见的登录档档名登录档所需相关服务 (daemon) 与程序CentOS 7.x 使用 systemd 提供的 journalctl 日志管理 登录档内容的一般格式 36.2 rsyslog.servi…

从 Ansible Galaxy 使用角色

从 Ansible Galaxy 使用角色 根据下列要求&#xff0c;创建一个名为 /home/curtis/ansible/roles.yml 的 playbook &#xff1a; playbook 中包含一个 play&#xff0c; 该 play 在 balancers 主机组中的主机上运行并将使用 balancer 角色。 此角色配置一项服务&#xff0c;以…

桌面软件开发框架 Electron、Qt、WPF 和 WinForms 怎么选?

一、Electron Electron 是一个基于 Web 技术的跨平台桌面应用程序开发框架。它使用 HTML、CSS 和 JavaScript 来构建应用程序界面,并借助 Chromium 渲染引擎提供强大的页面渲染能力。Electron 的主要特点包括: 跨平台:Electron 可以在 Windows、macOS 和 Linux 等多个主流操…

蓝蓝设计UI设计公司-界面设计与开发案例

天津航天中为项目 中国南方电网十二个软件交互优化和界面设计 图标设计 | 交互设计 | 界面设计 天津航天中为数据系统科技有限公司是航天503所控股的专业化公司&#xff0c;坐落于天津滨海新区航天技术产业园&#xff0c;是航天五院家入住天津未来科技城的军民融合型企业&…

回归预测 | MATLAB实现FA-BP萤火虫算法优化BP神经网络多输入单输出回归预测(多指标,多图)

回归预测 | MATLAB实现FA-BP萤火虫算法优化BP神经网络多输入单输出回归预测&#xff08;多指标&#xff0c;多图&#xff09; 目录 回归预测 | MATLAB实现FA-BP萤火虫算法优化BP神经网络多输入单输出回归预测&#xff08;多指标&#xff0c;多图&#xff09;效果一览基本介绍程…

JSON的处理

1、JSON JSON(JavaScript Object Notation)&#xff1a;是一种轻量级的数据交换格式。 它是基于 ECMAScript 规范的一个子集&#xff0c;采用完全独立于编程语言的文本格式来存储和表示数据。 简洁和清晰的层次结构使得 JSON 成为理想的数据交换语言。易于人阅读和编写&#…

Mybatis的学习笔记(IDEA快捷键,参数占位符,转义符)

一、IDEA快捷键&#xff1a; IDEA多行注释&#xff1a;ctrlShift/ 单行注释&#xff1a;ctrl/ 导入包&#xff0c;自动修正代码&#xff1a;altenter 自动生成代码&#xff1a;altinsert 二、Mybatis重要知识点&#xff1a; 2.1 参数占位符 一共分为2种&#xff1a;#{}和…

基于百度文心大模型创作的实践与谈论

文心概念 百度文心大模型源于产业、服务于产业&#xff0c;是产业级知识增强大模型。百度通过大模型与国产深度学习框架融合发展&#xff0c;打造了自主创新的AI底座&#xff0c;大幅降低了AI开发和应用的门槛&#xff0c;满足真实场景中的应用需求&#xff0c;真正发挥大模型…

5.7.webrtc线程的启动与运行

那在上一节课中呢&#xff1f;我向你介绍了web rtc的三大线程&#xff0c;包括了信令线程&#xff0c;工作线程以及网络线程。那同时呢&#xff0c;我们知道了web rtc 3大线程创建的位置以及运行的时机。 对吧&#xff0c;那么今天呢&#xff1f;我们再继续深入了解一下&#…

k8s v1.27.4 部署metrics-serverv:0.6.4,kube-prometheus

只有一个问题&#xff0c;原来的httpGet存活、就绪检测一直不通过&#xff0c;于是改为tcpSocket后pod正常。 wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml修改后的yaml文件&#xff0c;镜像修改为阿里云 apiVersion: …

窗口函数大揭秘!轻松计算数据累计占比,玩转数据分析的绝佳利器

上一篇文章《如何用窗口函数实现排名计算》中小编为大家介绍了窗口函数在排名计算场景中的应用&#xff0c;但实际上窗口函数除了可以进行单行计算&#xff0c;还可以在每行上打开一个指定大小的计算窗口&#xff0c;这个计算窗口可以由SQL中的语句具体指定&#xff0c;大到整个…

S05-巧用单元格格式转换数据

视频教程 文章目录 S05-巧用单元格格式转换数据 S05-巧用单元格格式转换数据 格式类型默认格式&#xff08;常规&#xff09;转换格式数值1.21.200货币1.2&#xffe5;1.20会计专用1.2&#xffe5;1.20日期43567四月十二日时间0.3333333338:00 AM百分比1.2120.00%分数0.21/5科…

工作纪实37-mybatis-plus关闭结果集输出log

1.springbootmybatis-pluslogback.xml组合&#xff0c;运行mapper会把sql查询会把结果也打印出来&#xff09;&#xff0c;但是就是不想让它输出到控制台&#xff0c;今天就来记录一下如何操作才能不把sql结果集打印出来&#xff0c;当然sql语句还是会打印的。 2、修改配置 …

响应式编程

响应式编程 响应式编程打破了传统的同步阻塞式编程模型&#xff0c;基于响应式数据流和背压机制实现了异步非阻塞式的网络通信、数据访问和事件驱动架构&#xff0c;能够减轻服务器资源之间的竞争关系&#xff0c;从而提高服务的响应能力。 一、Reactive Stream 要了解什么是响…

从零实战SLAM-第九课(后端优化)

在七月算法报的班&#xff0c;老师讲的蛮好。好记性不如烂笔头&#xff0c;关键内容还是记录一下吧&#xff0c;课程入口&#xff0c;感兴趣的同学可以学习一下。 --------------------------------------------------------------------------------------------------------…

【STM32CubeMX】低功耗模式

前言 本文讲解STM32F10X的低功耗模式&#xff0c;部分资料参考自STM32手册。STM32F10X提供了三种低功耗模式&#xff1a;睡眠模式&#xff08;Sleep mode&#xff09;、停机模式&#xff08;Stop mode&#xff09;和待机模式&#xff08;Standby mode&#xff09;。这些低功耗模…

mysql通过binlog日志恢复误删数据

1、先查看binlog功能是否开启 show variables like %log_bin%;log_bin为ON说明可以使用binlog恢复&#xff0c;如果为OFF说明没有开启binlog。 2、删除部分数据做测试 3、查找binlog文件位置 show variables like %datadir%;cd /var/lib/mysqlls -l删除数据时间是在文件154与…

7个改变玩法规则的ChatGPT应用场景

ChatGPT因各种原因受到了广泛关注&#xff1a;ChatGPT可以充当各种改善生活改进工作的小助手&#xff0c;如内容写手、客户支持、语言翻译、编码专家等等。只需在你的聊天内容中添加适当的提示&#xff0c;人工智能将为你提供各项支持。[1] 1.ChatGPT作为内容写手 通过AI的帮助…

有生日视频模板软件吗?分享一个模板丰富的视频软件

视频制作可以让你制作出一个生动、吸引人的生日视频&#xff0c;让你的生日祝福更加具有创意和个性化。通过使用生日模板视频&#xff0c;你可以省去很多制作视频的时间和精力&#xff0c;同时还可以获得高品质的视频输出。此外&#xff0c;生日模板视频通常具有专业的风格和设…