- 博客(14)
- 资源 (6)
- 收藏
- 关注
原创 flutter map对象转 json 字符串,格式化输出
String fmt(dynamic o, int lv, {String sp = ' '}) {String str = '';String pre = sp * lv;if (o is Map) {str += '{\n';for (var item in o.keys) {str += pre + '$sp\"$item\":${fmt(o[item], lv + 1)},\n';}str = str.replaceRange(str.length - 2, str.
2020-10-29 14:45:03
2608
原创 python 迷宫生成路线
#!/usr/bin/python# -*- coding: UTF-8 -*-import randomimport sysimport osimport timeimport turtleturtle.screensize(800,600, "seashell")turtle.pensize(16)turtle.pencolor('tomato')points = ...
2019-10-03 10:07:00
558
原创 图片组合生成最优正方形
任意数量的图片,通过等比例缩放,重新排列生成最接近的正方形。interface Item { w: number, h: number, s?: Item[]}function getIndex(len: number) { let x = 0; let y = 0; const arrat: Array<{ x: number, y: numbe...
2019-06-13 11:01:08
434
原创 正则表达式基本语法记录
基本语法查询笔记匹配字符. 匹配除换行符以外的任意字符 <====> \n 匹配换行\w 匹配字母或数字或下划线或汉字 <====> \W 匹配任意不是字母,数字,下划线,汉字的字符\s 匹配任意的空白符 <====> \S 匹配任意不是空白符的字符\d 匹配数字 <====> \D 匹配任意非数字的字符\b 匹配单词的开始或结束...
2019-06-05 10:19:56
161
原创 Canvas图片跨域问题
解决JS操作图片 跨域错误问题,Canvas 图片裁剪保存跨域错误const ctx = document.getElementById('canvas').getContext('2d'); const img = new Image(); img.onload = () => { ctx!.dra...
2019-06-05 10:11:33
1162
原创 关于连连看随机排列的算法
typedef struct{int x1, y1, x2, y2;}Pt;void fun(Pt pt[], int x, int y) //x列数,y行数{if (x*y % 2 == 1)//如果都是奇数,无解return;int i, j, m, n, k = 0, l = x * y / 2;char **num = new char
2014-04-07 18:45:53
1092
原创 九宫格拼图游戏
int GetPosX(int);int GetPosY(int);int GetPosX(int n){switch (n){case 1: return 0;case 4: return 0;case 7: return 0;case 2: return 1;case 5: return 1;case 8: return 1;case 3:
2014-04-05 11:19:56
1105
原创 C++速算24点原创代码
#includeusing namespace std;bool fun(int n1, int n2, int n, int opt, float num1[], float num2[])//n1,n2为选择num1数组的下标,opt是运算num2是结果数组,n为数组num1的长度{if (n1 == n2)return false;switch (opt)//
2014-04-02 22:15:01
1633
原创 题目:输入一个字符串,输出该字符串中字符的所有组合
//题目:输入一个字符串,输出该字符串中字符的所有组合//举个例子,如果输入abc,它的组合有a、b、c、ab、ac、bc、abc。#includeusing namespace std;int main(){char ch[] = "abc";unsigned n = 1,m = 1for (n = 1; n {for (unsi
2014-03-30 16:14:36
2394
原创 题目:在数组中,数字减去它右边的数字得到一个数对之差。
//题目:在数组中,数字减去它右边的数字得到一个数对之差。//求所有数对之差的最大值。例如在数组{ 2, 4, 1, 16, 7, 5, 11, 9 }中//数对之差的最大值是11,是16减去5的结果。#includeusing namespace std;int main(){int num[] = { 2, 4, 1, 16, 7, 11,5, 9 };
2014-03-30 16:12:54
3346
原创 把n个骰子扔在地上,所有骰子朝上一面的点数之和为S。输入n,打印出S的所有可能的值出现的概率
//题目:把n个骰子扔在地上,所有骰子朝上一面的点数之和为S。//输入n,打印出S的所有可能的值出现的概率#includeint main(){const double K = 0.16666666666666666666667;//常数 1/6int n; //输入色子数目std::cin >> n;double *num = new
2014-03-30 12:05:59
1887
原创 21点扑克游戏
#include#include#include#includeusing namespace std;class Game{public:Game() :nPair(4), nComputer(0), nPeople(0){}void Start();private:void ShowResWin(){cout cout
2014-03-27 14:16:23
1179
原创 表达式求值
#include #include#includeusing namespace std;class cal{public:cal(){}cal(string s) :str(s), res(0), IsRight(true){}void PutStr(string s){ str = s; }void ShowResult();private:
2014-03-26 15:49:21
502
原创 自己写的栈类,stack(*^__^*) 嘻嘻……
#include#includeusing namespace std;templateclass MyData{public:MyData(){};MyData(Type my) :item(my){};Type item;MyData* pNext;};templateclass MySta
2014-03-22 13:23:48
644
浅墨游戏开发笔记完整版
2014-05-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人