当前位置: 首页 > news >正文

【教学类-43-25】20240311 数独3宫格的所有可能(图片版 12套样式,空1格-空8格,每套510张,共6120小图)

背景需求:

有一位客户买3宫格所有可能(WORD表格版)

【教学类-43-25】20241203 数独3宫格的所有可能-使用模版替换-用时少报错少(12套样式,空1格-空8格,每套510张,共6120小图)_数独三宫格题目-CSDN博客文章浏览阅读2.3k次,点赞74次,收藏9次。【教学类-43-25】20241203 数独3宫格的所有可能-使用模版替换-用时少报错少(12套样式,空1格-空8格,每套510张,共6120小图)_数独三宫格题目 https://blog.csdn.net/reasonsummer/article/details/144225973?spm=1011.2415.3001.5331

这让我想起3宫格生成的漫长时间(510图*12套生成了8个小时),还有4宫格生成的恐惧——用word的12图插入数字的方法,页数太多,合并WORD总是卡死,无法合并成一个文件

修改思路

所以这次参考“像素图(图片版)”,也做一份所有数独样式的图片版

【教学类-13-19】20250228《数字色块像素图》图片版(1-4位数)-CSDN博客文章浏览阅读1.5k次,点赞48次,收藏13次。【教学类-13-19】20250228《数字色块像素图》图片版(1-4位数) https://blog.csdn.net/reasonsummer/article/details/145931618?spm=1011.2415.3001.5331

测试过程不提,直接上代码


'''
目的:数独3宫格,所有可能样式,做成图片
作者:阿夏
时间:20250311'''import math,os,time
from itertools import permutations
import random
from win32com.client import constants, gencache
from win32com.client.gencache import EnsureDispatch
from docx import Document
from docx.shared import Pt, RGBColor
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT, WD_BREAK
from docx.oxml.ns import qn
from docxtpl import DocxTemplate
import pandas as pd
from docx2pdf import convert
from datetime import datetimefrom PIL import Image, ImageDraw, ImageFont
import os
import copy# 开始时间
start_time = datetime.now()# 制作"单元格"# 几宫格
hs=3
# int(input('3宫格数独=3\n'))
# 内容太多了,容易报错,如果报错,就重新设置起始宫格数字1-8
start=1
# 第几套,第一套# 新建一个”装N份word和PDF“的临时文件夹
# 创建输出目录
path = r'C:\Users\jg2yXRZ\OneDrive\桌面\20250311 3宫格所有可能(图片版)\01三宫格图片版'
output_dir = path + r'\00全部'
os.makedirs(output_dir, exist_ok=True)print('------第2步:制作3宫格的12套题的内容-------')# 制作3宫格的12套题目(没有空格,只有基础模板)
lst=[]
for b in range(1,hs+1):lst.append(b)
print(lst)permutations_list = list(permutations(lst))
numbers = [list(permutation) for permutation in permutations_list]
print(numbers)
# [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
# 6种组合# 互相组合成3组
import itertools# 计算排列数量并生成所有可能的排列
combinations2 = list(itertools.permutations(numbers, hs))
# 包含相似的# 输出排列数量
print(len(combinations2))
# 120# # 把所有数字都提取成元素
ll=[]
for o1 in combinations2:for o2 in o1:for o3 in o2:ll.append(o3)print(ll)
print(len(ll))
# 1080v=hs*hs
# 9个数字抽取一组
f=[]
for i in range(int(len(ll)/v)):f.append(ll[i*v:i*v+v])
# print(f)
# print(len(f))
#120条# # # 遍历表格,把0、5、10相同的内容删除,横向的数字1234都正确了,现在只要排除竖向不对的P=[]
z=[]
for k in f:  if int(k[0])!=int(k[3])!=int(k[6]) and int(k[0])+int(k[3])+int(k[6])==6 and\int(k[1])!=int(k[4])!=int(k[7]) and int(k[1])+int(k[4])+int(k[7])==6 and\int(k[2])!=int(k[5])!=int(k[8]) and int(k[2])+int(k[5])+int(k[8])==6 and\int(k[0])!=int(k[1])!=int(k[2]) and int(k[0])+int(k[1])+int(k[2])==6 and\int(k[3])!=int(k[4])!=int(k[5]) and int(k[3])+int(k[4])+int(k[5])==6 and\int(k[6])!=int(k[7])!=int(k[8]) and int(k[6])+int(k[7])+int(k[8])==6 :z.append(k)print(z)
print(len(z))# 12种基础样式
basis=[]
for hh in z:print(hh)basis.append(hh)
print(basis)
print(len(basis))    # 12种基础样式
# [1, 2, 3, 2, 3, 1, 3, 1, 2]
# [1, 2, 3, 3, 1, 2, 2, 3, 1]
# [1, 3, 2, 2, 1, 3, 3, 2, 1]
# [1, 3, 2, 3, 2, 1, 2, 1, 3]
# [2, 1, 3, 1, 3, 2, 3, 2, 1]
# [2, 1, 3, 3, 2, 1, 1, 3, 2]
# [2, 3, 1, 1, 2, 3, 3, 1, 2]
# [2, 3, 1, 3, 1, 2, 1, 2, 3]
# [3, 1, 2, 1, 2, 3, 2, 3, 1]
# [3, 1, 2, 2, 3, 1, 1, 2, 3]
# [3, 2, 1, 1, 3, 2, 2, 1, 3]
# [3, 2, 1, 2, 1, 3, 1, 3, 2]
# # # 12道题目jc=path+fr'\{hs}宫格 基础{int(len(basis))}种'
os.makedirs(jc,exist_ok=True)# 制作12张原始基础样式
for n2 in range(len(basis)):# for ns in range(len(styles2[nt][nr])):t2=basis[n2]print(t2)# 设置画布参数rows = 3cols = 3cell_size = 100border_width = 10canvas_width = cols * cell_size + border_width * 2canvas_height = rows * cell_size + border_width * 2# 加载字体font_path = r'C:\Windows\Fonts\arial.ttf'  # 替换成你的字体文件路径font_size = 60font = ImageFont.truetype(font_path, font_size)# 创建图像canvas_color = (255, 255, 255)  # 白色image = Image.new('RGB', (canvas_width, canvas_height), canvas_color)draw = ImageDraw.Draw(image)# 绘制边框draw.rectangle([(0, 0), (canvas_width, canvas_height)], outline=(0, 0, 0), width=border_width)# 计算内部区域的起始点和结束点inner_start_x = border_widthinner_end_x = canvas_width - border_widthinner_start_y = border_widthinner_end_y = canvas_height - border_width# 绘制表格(去掉边框线10磅)for row in range(rows + 1):start_y = inner_start_y + row * cell_sizedraw.line((inner_start_x, start_y, inner_end_x, start_y), fill=(0, 0, 0))  # 水平线for col in range(cols + 1):start_x = inner_start_x + col * cell_sizedraw.line((start_x, inner_start_y, start_x, inner_end_y), fill=(0, 0, 0))  # 垂直线    # 在每个单元格的中心点写入数字for row in range(rows):for col in range(cols):index = row * cols + colnumber = t2[index]text = str(number)text_width, text_height = draw.textsize(text, font=font)center_x = inner_start_x + col * cell_size + (cell_size - text_width) // 2center_y = inner_start_y + row * cell_size + (cell_size - text_height) // 2 - 10# 绘制数字draw.text((center_x, center_y), text, font=font, fill=(0, 0, 0))# 绘制下划线underline_y = center_y + text_height // 1 + 10  # 调整下划线位置,使其位于数字下方draw.line((center_x - text_width //10, underline_y, center_x + text_width *1, underline_y), fill=(0, 0, 0), width=2)# 保存图像output_path1 = os.path.join(jc, f'{hs}宫格 基础样式{n2+1:02}.png')image.save(output_path1)print(f"Image saved to {output_path1}")print('---------第3步,原始列表生成样式1,了解数量和空格位置----------')
# 读取每一款,假设任意缺1空、任意缺2空,任意缺三空
# 原始列表
import itertools
m=1names=[]
styles1=[]
styles2=[]for a1 in  range(len(basis)):   a=basis[a1]print(a)# [1, 2, 3, 2, 3, 1, 3, 1, 2]# 12张一页的样式n=0xx=0for x in range(start,hs*hs):# 如果报错,就从相应的宫格数字继续生成l1=[]# 使用 combinations 生成所有不重复的组合combinations = list(itertools.combinations(range(len(a)), x))# 1有9次,2有36次,,3有84次,4有84次,3有84次,3有84次,3有84次,3有84次,3有84次,3有84次# 打印组合及其索引,并将索引位置的内容变成 ''for comb in combinations:# 创建副本以避免修改原始列表modified_list = a[:]# 将组合中的索引位置内容替换为 ''for index in comb:modified_list[index] = ''# print(f"{modified_list}")# print(f"Combination: {[modified_list[i] for i in comb]}, Indices: {comb}")l1.append(modified_list)# 输出组合的数量# print(l)   t=f"{hs}宫格 样式{a1+1:02} {x}空有{len(l1)}种"print(f"{hs}宫格 样式{a1+1:02} {x}空有{len(l1)}种")names.append(t)# 1空有9种# 2空有36种# 3空有84种# 4空有126种# 5空有126种# 6空有84种# 7空有36种# 8空有9种# 9空有1种n+=len(combinations)# # 3宫格1套,511种,# print(n)    # 510# # 3宫格1套,12种图案,每种510,共6132种,# print(n*len(basis))#     print(n*576)# 将嵌套列表转换为扁平列表flat_list = [item for sublist in l1 for item in sublist]print(flat_list)print(len(flat_list))# 81# 将 flat_list 拆分成每组包含9个元素的嵌套列表grouped_list= [flat_list[i:i + hs*hs] for i in range(0, len(flat_list),  hs*hs)]print(grouped_list)print(len(grouped_list))print('数字9个',grouped_list)styles1.append(grouped_list)# styles2.append(styles1)print(names)
print(len(names))
# 8种名称1-9
# 96种
# print(styles1)
# print(len(styles1)) # print(styles2)
# print(len(styles2))  
# 96种
# # 8种列表,每种数量不等,呈现正态分布    for nt in range(len(styles1)):# 按照样式1、2、3分组# wj=output_dir+fr'\{hs}宫格 样式{nt:02}'# os.makedirs(wj,exist_ok=True)for nr in range(len(styles1[nt])):# for ns in range(len(styles2[nt][nr])):t=styles1[nt][nr]print(t)# 设置画布参数rows = 3cols = 3cell_size = 100border_width = 10canvas_width = cols * cell_size + border_width * 2canvas_height = rows * cell_size + border_width * 2# 加载字体font_path = r'C:\Windows\Fonts\arial.ttf'  # 替换成你的字体文件路径font_size = 60font = ImageFont.truetype(font_path, font_size)# 创建图像canvas_color = (255, 255, 255)  # 白色image = Image.new('RGB', (canvas_width, canvas_height), canvas_color)draw = ImageDraw.Draw(image)# 绘制边框draw.rectangle([(0, 0), (canvas_width, canvas_height)], outline=(0, 0, 0), width=border_width)# 计算内部区域的起始点和结束点inner_start_x = border_widthinner_end_x = canvas_width - border_widthinner_start_y = border_widthinner_end_y = canvas_height - border_width# 绘制表格(去掉边框线10磅)for row in range(rows + 1):start_y = inner_start_y + row * cell_sizedraw.line((inner_start_x, start_y, inner_end_x, start_y), fill=(0, 0, 0))  # 水平线for col in range(cols + 1):start_x = inner_start_x + col * cell_sizedraw.line((start_x, inner_start_y, start_x, inner_end_y), fill=(0, 0, 0))  # 垂直线    # 在每个单元格的中心点写入数字for row in range(rows):for col in range(cols):index = row * cols + colnumber = t[index]text = str(number)text_width, text_height = draw.textsize(text, font=font)center_x = inner_start_x + col * cell_size + (cell_size - text_width) // 2center_y = inner_start_y + row * cell_size + (cell_size - text_height) // 2 - 10# 绘制数字draw.text((center_x, center_y), text, font=font, fill=(0, 0, 0))# 绘制下划线underline_y = center_y + text_height // 1 + 10  # 调整下划线位置,使其位于数字下方draw.line((center_x - text_width //10, underline_y, center_x + text_width *1, underline_y), fill=(0, 0, 0), width=2)# 保存图像output_path = os.path.join(output_dir, f'{names[nt]} {nr+1:03}.png')image.save(output_path)print(f"Image saved to {output_path}")# 每510张打包再一起,样式1 510张、样式2 510张、样式3 510张  
import os
import shutil# 设置源文件夹路径
source_folder = output_dir
print(source_folder)# C:\Users\jg2yXRZ\OneDrive\桌面\20250311 3宫格所有可能(图片版)\01三宫格图片版\00全部
basis = ['1'] * 12
n = 510
hs = 3  # Assuming hs is defined somewhere in your code
# path = "your_path"  # Replace with your actual path# 创建目标文件夹
for i in range(1, int(len(basis) + 1)):  # 假设总共有30个文件,分成3组folder_name = os.path.join(path, f"{hs}宫格 样式{i:02}")os.makedirs(folder_name, exist_ok=True)# 获取所有图片文件名
image_files = [f for f in os.listdir(source_folder) if f.endswith(('.png', '.jpg', '.jpeg'))]# 分组并复制文件 n=510
group_size = n
for i, file in enumerate(image_files):group_index = i // group_size + 1  # 计算当前文件属于第几组source_path = os.path.join(source_folder, file)destination_path = os.path.join(path, f"{hs}宫格 样式{group_index:02}", file)shutil.copy(source_path, destination_path)print(f"Copied {file} to {destination_path}")# 记录程序结束时间
end_time = datetime.now()# 计算程序运行时间
elapsed_time = end_time - start_timeprint(f"数独{hs}宫格程序开始时间:{start_time}")
print(f"数独{hs}宫格程序结束时间:{end_time}")# 打印程序运行时间
print("程序运行时间:", elapsed_time)

第1步:生成3宫格12套基本样式

第2步:生成3宫格每套基本样式中的所有可能(空1格有9种,空2个有36种……)每种有510种不同图案)乘以12套

第3步:以510张为分割,图片复制到“样式1”“样式2”文件夹中。

好了,用这个方法优势:

1、生成图片是320*320像素

2、大小都是9KB

3、6120张图片生成和转移时间大约2分钟。

以图片方式直接获取数独内容,可以反复引用,制作出一页12张,一页6张,一页2张,一页1张的模版。

做成PDF,可能生成WORD的时间比较长

后续

把这个代码修改一下,做 一套4宫格所有可能(图片版)


'''
目的:数独4宫格,所有可能样式,做成图片(调整下划线位置
作者:阿夏
时间:20250311'''import math,os,time
from itertools import permutations
import random
from win32com.client import constants, gencache
from win32com.client.gencache import EnsureDispatch
from docx import Document
from docx.shared import Pt, RGBColor
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT, WD_BREAK
from docx.oxml.ns import qn
from docxtpl import DocxTemplate
import pandas as pd
from docx2pdf import convert
from datetime import datetimefrom PIL import Image, ImageDraw, ImageFont
import os
import copy# 开始时间
start_time = datetime.now()# 制作"单元格"# 几宫格
hs=4
# int(input('4宫格数独=3\n'))
# 内容太多了,容易报错,如果报错,就重新设置起始宫格数字1-8
start=1
# 第几套,第一套# 新建一个”装N份word和PDF“的临时文件夹
# 创建输出目录
path = r'C:\Users\jg2yXRZ\OneDrive\桌面\20250311 4宫格所有可能(图片版)\01四宫格图片版'
os.makedirs(path, exist_ok=True)
output_dir = path + r'\00全部'
os.makedirs(output_dir, exist_ok=True)print('------第2步:制作4宫格的12套题的内容-------')# 制作4宫格的12套题目(没有空格,只有基础模板)
lst=[]
for b in range(1,hs+1):lst.append(b)
print(lst)permutations_list = list(permutations(lst))
numbers = [list(permutation) for permutation in permutations_list]
# print(numbers)
# [[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 2, 3], [1, 4, 3, 2], [2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], [2, 4, 3, 1], [3, 1, 2, 4], [3, 1, 4, 2], [3, 2, 1, 4], [3, 2, 4, 1], [3, 4, 1, 2], [3, 4, 2, 1], [4, 1, 2, 3], [4, 1, 3, 2], [4, 2, 1, 3], [4, 2, 3, 1], [4, 3, 1, 2], [4, 3, 2, 1]]PS D:\test>
# 6种组合# 互相组合成3组
import itertools# 计算排列数量并生成所有可能的排列
combinations2 = list(itertools.permutations(numbers, hs))
# 包含相似的# 输出排列数量
print(len(combinations2))
# 120# # 把所有数字都提取成元素
ll=[]
for o1 in combinations2:for o2 in o1:for o3 in o2:ll.append(o3)print(ll)
print(len(ll))
# 1080v=hs*hs
# 9个数字抽取一组
f=[]
for i in range(int(len(ll)/v)):f.append(ll[i*v:i*v+v])
# print(f)
# print(len(f))
#120条# # # 遍历表格,把0、5、10相同的内容删除,横向的数字1234都正确了,现在只要排除竖向不对的P=[]
z=[]
for k in f:  if int(k[0])!=int(k[4])and int(k[0])!=int(k[8])and int(k[0])!=int(k[12]) and int(k[4])!=int(k[8]) and int(k[4])!=int(k[12])and int(k[8])!=int(k[12]) and int(k[0])+int(k[4])+int(k[8])+int(k[12])==10 and \int(k[1])!=int(k[5])and int(k[1])!=int(k[9])and int(k[1])!=int(k[13]) and int(k[5])!=int(k[9]) and int(k[5])!=int(k[13])and int(k[9])!=int(k[13])  and int(k[1])+int(k[5])+int(k[9])+int(k[13])==10 and \int(k[2])!=int(k[6])and int(k[2])!=int(k[10])and int(k[2])!=int(k[14]) and int(k[6])!=int(k[10]) and int(k[6])!=int(k[14])and int(k[10])!=int(k[14]) and int(k[2])+int(k[6])+int(k[10])+int(k[14])==10 and\int(k[3])!=int(k[7])and int(k[3])!=int(k[11])and int(k[3])!=int(k[15]) and int(k[7])!=int(k[11]) and int(k[7])!=int(k[15])and int(k[11])!=int(k[15])  and int(k[3])+int(k[7])+int(k[11])+int(k[15])==10:z.append(k)# print(z)
# print(len(z))# 12种基础样式
basis=[]
for hh in z:print(hh)basis.append(hh)
# print(basis)
# print(len(basis))   # 576种基础样式# [1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 1, 2, 4, 3, 2, 1]
# [1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 2, 1, 4, 3, 1, 2]
# [1, 2, 3, 4, 2, 1, 4, 3, 4, 3, 1, 2, 3, 4, 2, 1]
# [1, 2, 3, 4, 2, 1, 4, 3, 4, 3, 2, 1, 3, 4, 1, 2]
# [1, 2, 3, 4, 2, 3, 4, 1, 3, 4, 1, 2, 4, 1, 2, 3]
# [1, 2, 3, 4, 2, 3, 4, 1, 4, 1, 2, 3, 3, 4, 1, 2]
# [1, 2, 3, 4, 2, 4, 1, 3, 3, 1, 4, 2, 4, 3, 2, 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, 3]
# [4, 3, 2, 1, 2, 1, 3, 4, 1, 2, 4, 3, 3, 4, 1, 2]
# [4, 3, 2, 1, 2, 1, 3, 4, 3, 4, 1, 2, 1, 2, 4, 3]
# [4, 3, 2, 1, 2, 1, 4, 3, 1, 2, 3, 4, 3, 4, 1, 2]
# [4, 3, 2, 1, 2, 1, 4, 3, 1, 4, 3, 2, 3, 2, 1, 4]
# [4, 3, 2, 1, 2, 1, 4, 3, 3, 2, 1, 4, 1, 4, 3, 2]
# [4, 3, 2, 1, 2, 1, 4, 3, 3, 4, 1, 2, 1, 2, 3, 4]
# [4, 3, 2, 1, 2, 4, 1, 3, 1, 2, 3, 4, 3, 1, 4, 2]
# [4, 3, 2, 1, 2, 4, 1, 3, 3, 1, 4, 2, 1, 2, 3, 4]
# [4, 3, 2, 1, 3, 1, 4, 2, 1, 2, 3, 4, 2, 4, 1, 3]
# [4, 3, 2, 1, 3, 1, 4, 2, 2, 4, 1, 3, 1, 2, 3, 4]
# [4, 3, 2, 1, 3, 2, 1, 4, 1, 4, 3, 2, 2, 1, 4, 3]
# [4, 3, 2, 1, 3, 2, 1, 4, 2, 1, 4, 3, 1, 4, 3, 2]
# [4, 3, 2, 1, 3, 4, 1, 2, 1, 2, 3, 4, 2, 1, 4, 3]
# [4, 3, 2, 1, 3, 4, 1, 2, 1, 2, 4, 3, 2, 1, 3, 4]
# [4, 3, 2, 1, 3, 4, 1, 2, 2, 1, 3, 4, 1, 2, 4, 3]
# [4, 3, 2, 1, 3, 4, 1, 2, 2, 1, 4, 3, 1, 2, 3, 4]# 576道题目jc=path+fr'\{hs}宫格 基础{int(len(basis))}种'
os.makedirs(jc,exist_ok=True)# 制作12张原始基础样式
for n2 in range(len(basis)):# for ns in range(len(styles2[nt][nr])):t2=basis[n2]print(t2)# 设置画布参数rows = 4cols = 4cell_size = 100border_width = 10canvas_width = cols * cell_size + border_width * 2canvas_height = rows * cell_size + border_width * 2# 加载字体font_path = r'C:\Windows\Fonts\arial.ttf'  # 替换成你的字体文件路径font_size = 60font = ImageFont.truetype(font_path, font_size)# 创建图像canvas_color = (255, 255, 255)  # 白色image = Image.new('RGB', (canvas_width, canvas_height), canvas_color)draw = ImageDraw.Draw(image)# 绘制边框draw.rectangle([(0, 0), (canvas_width, canvas_height)], outline=(0, 0, 0), width=border_width)# 计算内部区域的起始点和结束点inner_start_x = border_widthinner_end_x = canvas_width - border_widthinner_start_y = border_widthinner_end_y = canvas_height - border_width# 绘制表格(去掉边框线10磅)for row in range(rows + 1):start_y = inner_start_y + row * cell_sizedraw.line((inner_start_x, start_y, inner_end_x, start_y), fill=(0, 0, 0))  # 水平线for col in range(cols + 1):start_x = inner_start_x + col * cell_sizedraw.line((start_x, inner_start_y, start_x, inner_end_y), fill=(0, 0, 0))  # 垂直线    # 在每个单元格的中心点写入数字for row in range(rows):for col in range(cols):index = row * cols + colnumber = t2[index]text = str(number)text_width, text_height = draw.textsize(text, font=font)center_x = inner_start_x + col * cell_size + (cell_size - text_width) // 2center_y = inner_start_y + row * cell_size + (cell_size - text_height) // 2 - 10# 绘制数字draw.text((center_x, center_y), text, font=font, fill=(0, 0, 0))# 绘制下划线underline_y = center_y + text_height // 1 + 10  # 调整下划线位置,使其位于数字下方draw.line((center_x - text_width //10, underline_y, center_x + text_width *1, underline_y), fill=(0, 0, 0), width=2)# 保存图像output_path1 = os.path.join(jc, f'{hs}宫格 基础样式{n2+1:03}.png')image.save(output_path1)print(f"Image saved to {output_path1}")print('---------第3步,原始列表生成样式1,了解数量和空格位置----------')
# 读取每一款,假设任意缺1空、任意缺2空,任意缺三空
# 原始列表
import itertools
m=1names=[]
styles1=[]
styles2=[]for a1 in  range(len(basis)):   a=basis[a1]print(a)# [1, 2, 3, 2, 3, 1, 3, 1, 2]# 12张一页的样式n=0xx=0for x in range(start,hs*hs):# 如果报错,就从相应的宫格数字继续生成l1=[]# 使用 combinations 生成所有不重复的组合combinations = list(itertools.combinations(range(len(a)), x))# 1有9次,2有36次,,3有84次,4有84次,3有84次,3有84次,3有84次,3有84次,3有84次,3有84次# 打印组合及其索引,并将索引位置的内容变成 ''for comb in combinations:# 创建副本以避免修改原始列表modified_list = a[:]# 将组合中的索引位置内容替换为 ''for index in comb:modified_list[index] = ''# print(f"{modified_list}")# print(f"Combination: {[modified_list[i] for i in comb]}, Indices: {comb}")l1.append(modified_list)# 输出组合的数量# print(l)   t=f"{hs}宫格 样式{a1+1:03} {x}空有{len(l1)}种"print(f"{hs}宫格 样式{a1+1:03} {x}空有{len(l1)}种")names.append(t)# 1空有9种# 2空有36种# 3空有84种# 4空有126种# 5空有126种# 6空有84种# 7空有36种# 8空有9种# 9空有1种n+=len(combinations)# # 4宫格1套,511种,# print(n)    # 510# # 4宫格1套,12种图案,每种510,共6132种,# print(n*len(basis))#     print(n*576)# 将嵌套列表转换为扁平列表flat_list = [item for sublist in l1 for item in sublist]print(flat_list)print(len(flat_list))# 81# 将 flat_list 拆分成每组包含9个元素的嵌套列表grouped_list= [flat_list[i:i + hs*hs] for i in range(0, len(flat_list),  hs*hs)]print(grouped_list)print(len(grouped_list))print('数字9个',grouped_list)styles1.append(grouped_list)# styles2.append(styles1)print(names)
print(len(names))
# 8种名称1-9
# 96种
# print(styles1)
# print(len(styles1)) # print(styles2)
# print(len(styles2))  
# 96种
# # 8种列表,每种数量不等,呈现正态分布    for nt in range(len(styles1)):# 按照样式1、2、3分组# wj=output_dir+fr'\{hs}宫格 样式{nt:02}'# os.makedirs(wj,exist_ok=True)for nr in range(len(styles1[nt])):# for ns in range(len(styles2[nt][nr])):t=styles1[nt][nr]print(t)# 设置画布参数rows = 4cols = 4cell_size = 100border_width = 10canvas_width = cols * cell_size + border_width * 2canvas_height = rows * cell_size + border_width * 2# 加载字体font_path = r'C:\Windows\Fonts\arial.ttf'  # 替换成你的字体文件路径font_size = 60font = ImageFont.truetype(font_path, font_size)# 创建图像canvas_color = (255, 255, 255)  # 白色image = Image.new('RGB', (canvas_width, canvas_height), canvas_color)draw = ImageDraw.Draw(image)# 绘制边框draw.rectangle([(0, 0), (canvas_width, canvas_height)], outline=(0, 0, 0), width=border_width)# 计算内部区域的起始点和结束点inner_start_x = border_widthinner_end_x = canvas_width - border_widthinner_start_y = border_widthinner_end_y = canvas_height - border_width# 绘制表格(去掉边框线10磅)for row in range(rows + 1):start_y = inner_start_y + row * cell_sizedraw.line((inner_start_x, start_y, inner_end_x, start_y), fill=(0, 0, 0))  # 水平线for col in range(cols + 1):start_x = inner_start_x + col * cell_sizedraw.line((start_x, inner_start_y, start_x, inner_end_y), fill=(0, 0, 0))  # 垂直线    # 在每个单元格的中心点写入数字for row in range(rows):for col in range(cols):index = row * cols + colnumber = t[index]text = str(number)text_width, text_height = draw.textsize(text, font=font)center_x = inner_start_x + col * cell_size + (cell_size - text_width) // 2center_y = inner_start_y + row * cell_size + (cell_size - text_height) // 2 - 10# 绘制数字draw.text((center_x, center_y), text, font=font, fill=(0, 0, 0))# 绘制下划线underline_y = center_y + text_height // 1 + 10  # 调整下划线位置,使其位于数字下方draw.line((center_x - text_width //10, underline_y, center_x + text_width *1, underline_y), fill=(0, 0, 0), width=2)# 保存图像output_path = os.path.join(output_dir, f'{names[nt]} {nr+1:05}.png')image.save(output_path)print(f"Image saved to {output_path}")# 每510张打包再一起,样式1 510张、样式2 510张、样式3 510张  
import os
import shutil# 设置源文件夹路径
source_folder = output_dir
print(source_folder)# C:\Users\jg2yXRZ\OneDrive\桌面\20250311 4宫格所有可能(图片版)\01三宫格图片版\00全部hs = 4  # Assuming hs is defined somewhere in your code
# path = "your_path"  # Replace with your actual path# 创建目标文件夹
for i in range(1, int(len(basis) + 1)):  # 假设总共有30个文件,分成3组folder_name = os.path.join(path, f"{hs}宫格 样式{i:03}")os.makedirs(folder_name, exist_ok=True)# 获取所有图片文件名
image_files = [f for f in os.listdir(source_folder) if f.endswith(('.png', '.jpg', '.jpeg'))]# 分组并复制文件 n=510
group_size = n
for i, file in enumerate(image_files):group_index = i // group_size + 1  # 计算当前文件属于第几组source_path = os.path.join(source_folder, file)destination_path = os.path.join(path, f"{hs}宫格 样式{group_index:05}", file)shutil.copy(source_path, destination_path)print(f"Copied {file} to {destination_path}")# 记录程序结束时间
end_time = datetime.now()# 计算程序运行时间
elapsed_time = end_time - start_timeprint(f"数独{hs}宫格程序开始时间:{start_time}")
print(f"数独{hs}宫格程序结束时间:{end_time}")# 打印程序运行时间
print("程序运行时间:", elapsed_time)

这个4宫格有576套,现在正在获取所有的全部图片,电脑啸叫厉害,估计要内存不够了

相关文章:

【教学类-43-25】20240311 数独3宫格的所有可能(图片版 12套样式,空1格-空8格,每套510张,共6120小图)

背景需求: 有一位客户买3宫格所有可能(WORD表格版) 【教学类-43-25】20241203 数独3宫格的所有可能-使用模版替换-用时少报错少(12套样式,空1格-空8格,每套510张,共6120小图)_数独三…...

Manus AI:多语言手写识别的技术革命与未来图景

摘要:在全球化浪潮下,跨语言沟通的需求日益迫切,但手写文字的多样性却成为技术突破的难点。Manus AI凭借其多语言手写识别技术,将潦草笔迹转化为精准数字文本,覆盖全球超百种语言。本文从技术原理、应用场景、行业价值…...

领域驱动设计(DDD)是什么?

领域驱动设计(DDD)是什么? 在软件开发的世界里,我们总在寻找那把打开业务之门的钥匙。有人迷恋MVC的简洁,有人追逐微服务的潮流,而DDD(领域驱动设计)则像一位沉默的智者,…...

JavaScript 模块 vs C# 类:封装逻辑的两种哲学

引言 在现代软件开发中,模块化和面向对象设计是代码组织的核心课题。本文通过对比 JavaScript 模块(ES6 Module)与 C# 类(Class)的实现方式,探讨两种语言在封装逻辑时的不同哲学,并给出实际应用…...

2.2 企业级ESLint/Prettier规则定制

文章目录 1. 为什么需要企业级代码规范2. 工具选型对比3. 完整配置流程3.1 项目初始化3.2 ESLint深度配置3.3 Prettier精细配置3.4 解决规则冲突4. 高级定制方案4.1 自定义ESLint规则4.2 扩展Prettier插件5. 团队协作策略5.1 配置共享方案5.2 版本控制策略6. CI/CD集成7. 常见问…...

Linux学习(十五)(故障排除(ICMP,Ping,Traceroute,网络统计,数据包分析))

故障排除是任何 Linux 用户或管理员的基本技能。这涉及识别和解决 Linux 系统中的问题。这些问题的范围包括常见的系统错误、硬件或软件问题、网络连接问题以及系统资源的管理。Linux 中的故障排除过程通常涉及使用命令行工具、检查系统和应用程序日志文件、了解系统进程&#…...

DeepIn Wps 字体缺失问题

系统缺失字体 Symbol 、Wingdings 、Wingdings2、Wingdings3、MT—extra 字体问题 问了下DeepSeek 在应用商店安装或者在windows 里面找 装了一个GB-18030 还是不行 在windows里面复制了缺失的字体 将字体复制到DeepIn 的字体目录(Ubuntu 应该也是这个目录&am…...

(二分 数学推导 统计公平数对的数目)leetcode 2563

数学推导&#xff1a; lower < nums[i] nums[j] < upper且0 < i < j < n 则lower-nums[j]<nums[i]<upper-nums[j] 找到这个范围的nums[i]的个数就是我们要的值 所以枚举j 在0--&#xff08;j-1&#xff09;的范围内 找到第一个大于等于lower-nums[j]…...

临界比例法PID调整-附带pidtune工具和GA算法

代码已上传&#xff1a;计算机控制系统PID参数整定法资源-CSDN文库 1背景 为了模拟PID参数整定&#xff0c;把教材上的案例进行分析。 1题目 单位闭环传递函数&#xff0c;开环传函G(s)1/((s1)(s2)), Ts0.1s, PID调整器输出后&#xff0c;接零阶保持器ZOH。 2 代码 PID含积…...

LabVIEW基于双通道FFT共轭相乘的噪声抑制

对于双通道采集的含噪信号&#xff0c;通过FFT获取复数频谱后&#xff0c;对第二通道频谱取共轭并与第一通道频谱相乘&#xff0c;理论上可增强相关信号成分并抑制非相关噪声。此方法适用于通道间信号高度相关、噪声独立的场景&#xff08;如共模干扰抑制&#xff09;。以下为L…...

小程序SSL证书过期怎么办?

SSL证书就像小程序的“安全锁”&#xff0c;一旦过期&#xff0c;用户访问时会被提示“不安全”&#xff0c;轻则流失客户&#xff0c;重则数据泄露&#xff01;作为企业负责人&#xff0c;如何快速解决证书过期问题&#xff1f;又该如何避免再次踩坑&#xff1f;这篇指南给你答…...

ELK日志分析实战

ELK日志分析实战&#xff1a;从异常流量定位提权攻击 摘要&#xff1a;本文通过模拟真实攻防场景&#xff0c;结合ELK技术栈&#xff08;ElasticsearchLogstashKibana&#xff09;&#xff0c;演示如何从海量服务器日志中快速定位异常流量并追踪提权攻击行为。包含完整的日志收…...

阿里云操作系统控制台实战评测:提升云资源管理与监控效率

文章目录 前言产品介绍操作系统控制台体验阿里云操作系统开通 帮助与总结建议 前言 随着云计算和虚拟化技术的发展&#xff0c;操作系统控制台作为运维管理的核心工具之一&#xff0c;在现代IT环境中发挥着越来越重要的作用。它提供了一种更加直观、高效的方式来管理操作系统&…...

Docker构建启动jar包

Docker构建启动jar包 1、首先是把java服务打包成jar包 mvn clean install -Dmaven.skip.testtrue package -Pprod这个命令的意思是&#xff0c;跳过测试&#xff0c;打包prod环境。 2、编写Dockerfile文件 # 拉取jdk8作为基础镜像 FROM registry.supos.ai/library/openjdk:…...

微信小程序使用的SSL证书在哪里申请?

在数字化时代&#xff0c;微信小程序已成为众多企业和个人开发者触达用户的重要平台。然而&#xff0c;随着网络安全威胁的日益严峻&#xff0c;确保小程序数据传输的安全性显得尤为重要。SSL证书&#xff0c;作为加密通信的基石&#xff0c;是保障小程序安全不可或缺的一环。 …...

基于langchain+llama2的本地私有大语言模型实战

Langchain功能 LangChian 作为一个大语言模型&#xff08;LLM, Large Language Model&#xff09;开发框架&#xff0c;是 LLM 应用架构的重要一环。借助 LangChain&#xff0c;我们可以创建各种应用程序&#xff0c;包括聊天机器人和智能问答工具。 AI模型&#xff1a;包含各…...

如何使用postman来测试接口

一、postman的介绍与下载 可参考&#xff1a; https://blog.csdn.net/freeking101/article/details/80774271 二、api获取网站 阿里云API应用市场 地址&#xff1a;云市场_镜像市场_软件商店_建站软件_服务器软件_API接口_应用市场 - 阿里云 三、具体测试过程 可模拟浏览…...

深入剖析B树、B+树与B*树:从二叉树到多叉树的演进

引言 在计算机科学中&#xff0c;树结构是数据存储和检索的核心工具之一。从二叉树到二叉排序树&#xff0c;再到平衡二叉树&#xff0c;我们已经看到了这些数据结构在高效处理数据方面的优势。然而&#xff0c;随着数据量的爆炸式增长&#xff0c;二叉树的局限性逐渐显现出来…...

《算法篇:三数之和问题的两种解法》

问题描述 给定一个包含 n 个整数的数组 nums&#xff0c;判断 nums 中是否存在三个元素 a&#xff0c;b&#xff0c;c &#xff0c;使得 a b c 0 &#xff1f;找出所有满足条件且不重复的三元组。 注意&#xff1a;答案中不可以包含重复的三元组。 给定数组 nums [-1, 0,…...

【2025】基于springboot+uniapp的乡村旅游小程序系统统(源码、万字文档、图文修改、调试答疑)农家乐预约

乡村旅游小程序系统通过 Spring Boot 与 uniapp 技术栈的深度整合&#xff0c;为乡村旅游产业打造了一个功能全面、交互流畅、性能稳定的综合服务平台。系统根据不同角色&#xff08;管理员、商家、用户&#xff09;的业务需求&#xff0c;提供了针对性的功能模块&#xff0c;实…...

DeepSeek Kimi详细生成PPT的步骤

以下是使用 DeepSeek 和 Kimi 协作生成 PPT 的详细步骤&#xff0c;结合了两者的优势实现高效创作&#xff1a; 第一步&#xff1a;使用 DeepSeek 生成 PPT 大纲或内容 明确需求并输入提示词 在 DeepSeek 的对话界面中&#xff0c;输入具体指令&#xff0c;要求生成 PPT 大纲或…...

【Film】MM-StoryAgent:沉浸式叙事故事书视频生成,具有跨文本、图像和音频的多代理范式

MM-StoryAgent:沉浸式叙事故事书视频生成,具有跨文本、图像和音频的多代理范式 https://arxiv.org/abs/2503.05242 MM-StoryAgent: Immersive Narrated Storybook Video Generation with a Multi-Agent Paradigm across Text, Image and Audio The rapid advancement of larg…...

Tweak Power:全方位电脑系统优化的高效工具

在日常使用电脑时&#xff0c;系统性能的下降、垃圾文件的堆积以及硬盘的老化等问题常常困扰着用户。为了提升电脑性能、优化系统运行&#xff0c;许多人会选择系统优化工具。然而&#xff0c;国内一些系统优化软件常常因为广告过多或功能冗杂而让人望而却步。此时&#xff0c;…...

LVDS系列3:Xilinx的IOBUFDS原语

前面两节讲解了差分转单端的IBUFDS原语和单端转差分的OBUFDS原语&#xff0c;今天来讲一个同时带有两者功能的原语IOBUFDS&#xff1b; 前述的IBUFDS原语只能接收外部差分信号&#xff0c;此时连接管脚为input管脚&#xff0c;OBUFDS只能向外部输出差分信号&#xff0c;此时连接…...

Git和GitHub基础教学

文章目录 1. 前言2. 历史3. 下载安装Git3.1 下载Git3.2 安装Git3.3 验证安装是否成功 4. 配置Git5. Git基础使用5.1 通过Git Bash使用5.1.1 创建一个新的仓库。5.1.1.1 克隆别人的仓库5.1.1.2 自己创建一个本地仓库 5.1.2 管理存档 5.2 通过Visual Studio Code使用 6. Git完成远…...

Django-ORM-select_related

Django-ORM-select_related 作用使用场景示例无 select_related 的查询有 select_related 的查询 如何理解 "只发起一次查询&#xff0c;包含所有相关作者信息"1. select_related 的工作原理2. 具体示例解析3. 为什么只发起一次查询 数据库中的books量巨大&#xff0…...

蓝桥杯 k倍区间

题目描述 给定一个长度为 NN 的数列&#xff0c;A1,A2,⋯ANA1​,A2​,⋯AN​&#xff0c;如果其中一段连续的子序列 Ai,Ai1,⋯AjAi​,Ai​1,⋯Aj​ ( i≤ji≤j ) 之和是 KK 的倍数&#xff0c;我们就称这个区间 [i,j][i,j] 是 K 倍区间。 你能求出数列中总共有多少个 KK 倍区间…...

数据结构(蓝桥杯常考点)

数据结构 前言&#xff1a;这个是针对于蓝桥杯竞赛常考的数据结构内容&#xff0c;基础算法比如高精度这些会在下期给大家总结 数据结构 竞赛中&#xff0c;时间复杂度不能超过10的7次方&#xff08;1秒&#xff09;到10的8次方&#xff08;2秒&#xff09; 空间限制&#x…...

Tomcat+Servlet运行后出现404错误解决方案

TomcatServlet运行后出现404错误解决方案 一、错误效果复现 后续的解决方案&#xff0c;仅仅针对我遇到的情况。对不能涵盖大部分情况感到抱歉。 二、错误分析 先看看源代码&#xff1f; package com.example.secondclass.Servlet; import java.io.*; import jakarta.servl…...

论文摘要生成器:用TextRank算法实现文献关键信息提取

我们基于python代码&#xff0c;使用PyQt5创建图形用户界面&#xff08;GUI&#xff09;&#xff0c;同时支持中英文两种语言的文本论文文献关键信息提取。 PyQt5&#xff1a;用于创建GUI应用程序。 jieba&#xff1a;中文分词库&#xff0c;用于中文文本的处理。 re&#xff…...