当前位置:网站首页>Simple Lianliankan games based on QT
Simple Lianliankan games based on QT
2022-06-26 20:59:00 【biyezuopinvip】
Resource download address :https://download.csdn.net/download/sheziqiong/85788216
Resource download address :https://download.csdn.net/download/sheziqiong/85788216
Simple Lianliankan games .
Overall process
Realize the idea :
Define game model class and game window class , Use the buttons to complete the game interface settings
Algorithm
Mainly in the storage of icons and the judgment of confusion and connection
Storage and disorder of icons : Using one-dimensional array , Assign values to the array two by two , It is a pair of icons , Assign values to an array 1~ Number of icons ICON, The values in the array correspond to the corresponding numbered pictures . Then generate random numbers , Swap the values of array elements in pairs , Achieve disruption
Connection judgment : There are three main types of connections : Straight line connection 、 Connect after turning once 、 Turn twice and connect , As follows :
① Direct connection :
Case 1: Judge that the array element values on the line are all 0.
Case 2: Judge that the array element values on the line are all 0.
②
Connect after turning once :
Order of switching points before connection , Make the point with the smaller abscissa in front .
Case 3: The connection first turns right and then up or down , Judge the inflection point as 0, Then judge the inflection point and the starting point 、 The ends are connected in a straight line .
Case 4: The connection goes up or down and then turns right , Judge the inflection point as 0, Then judge the inflection point and the starting point 、 The ends are connected in a straight line .
③ Turn twice and connect :
The same sequence of switching points before connection , Make the point with the smaller abscissa in front .
Case 5: Go up or down to a point first , Take a turn to the end ( The points that the connection passes through initially store pictures ).
Case 6: Go left or right to a point first , Take a turn to the end ( The points that the connection passes through initially store pictures ).
Case 7、8、9、10: When connecting, the connection passes through the area where the icon is not stored
unit testing
Output through the application , Generate window , Play games
unit testing
test result
The game can run normally , Each button can be used normally
Harvest
Use multiple at the same time for the first time .cpp File implementations call each other
Learned the game design concept of separating the game model from the form
To study the Qt Many functions of the button class
Normal use
Harvest
Use multiple at the same time for the first time .cpp File implementations call each other
Learned the game design concept of separating the game model from the form
To study the Qt Many functions of the button class
Resource download address :https://download.csdn.net/download/sheziqiong/85788216
Resource download address :https://download.csdn.net/download/sheziqiong/85788216
边栏推荐
猜你喜欢
Leetcode question brushing: String 02 (reverse string II)
郭明錤:苹果 AR / MR 头显是其有史以来设计最复杂的产品,将于 2023 年 1 月发布
Arduino uno + DS1302 uses 31 byte static RAM to store data and print through serial port
Idea error: process terminated
[serial] shuotou O & M monitoring system 01 overview of monitoring system
leetcode刷题:字符串04(颠倒字符串中的单词)
MySQL - database creation and management
【protobuf 】protobuf 升级后带来的一些坑
leetcode刷题:字符串01(反转字符串)
Muke 11. User authentication and authorization of microservices
随机推荐
C: Reverse linked list
Establish a connection with MySQL
Feitian +cipu body brings more imagination to the metauniverse
windows系统下怎么安装mysql8.0数据库?(图文教程)
Redis + Guava 本地缓存 API 组合,性能炸裂!
C language simple login
Is it safe to open an online account in case of five-year exemption?
Sentinelresource annotation details
[Shandong University] information sharing for the first and second examinations of postgraduate entrance examination
飞天+CIPU体为元宇宙带来更大想象空间
C language file cursor fseek
与 MySQL 建立连接
Development of NFT for digital collection platform
Leetcode question brushing: String 05 (Sword finger offer 58 - ii. left rotation string)
Yonghui released the data of Lantern Festival: the sales of Tangyuan increased significantly, and several people's livelihood products increased by more than 150%
515. find the maximum value in each tree row
Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023
分布式ID生成系统
swagger:如何生成漂亮的静态文档说明页
[Bayesian classification 3] semi naive Bayesian classifier