Bingo卡片案例笔记【五】、生成不重复并且完整的数字

TimespinnerBingo:适用于Timespinner的Bingo卡生成器 立即下载

根据上一篇文章的代码,我们生成了合乎bingo卡片规范的数字。

但是,出现了一个新的问题即生成的文字会出现重复的情况。为了避免出现重复的情况出现,我们采用了do...while和数组的方式来重复生成数字,直到所有数字不重复为止。

代码如下:

window.onload=newCard;
var usedNum = new Array(76);
function newCard(){
	for(var i=0;i<24;i++)
	{
		setSquare(i);
	}
	}
function setSquare(thissquare){
	var colPlace=new Array(0,1,2,3,4,0,1,2,3,4,0,1,3,4,0,1,2,3,4,0,1,2,3,4);
	do{
	var newNums=getNewNum()+1+colPlace[thissquare]*15;
	}
	while(usedNum[newNums]);
	usedNum[newNums]=true;
	document.getElementById("square"+thissquare).innerHTML=newNums;
}
function getNewNum() {
	return Math.floor(Math.random() * 15);
}

到这里,我们就生成了一个完整的bingo卡片。快去试试效果吧!


宾果游戏 卡片 打印 打印宾果游戏卡片,支持自定义logo名字,支持数字范围 立即下载

相关推荐

bingo:生成宾果网格的工具

答对了 生成宾果网格。 执照 此代码是根据MIT许可条款发布的免费软件。

Bingo卡片案例笔记【四】、生成符合规范的数字

根据bingo卡片的要求可以知道,bingo卡片对生成的数字有着规定的要求,要求如下: B列中的数字要求是1~15之间的任一数字 I列中的数字要求是16~30之间的任一数字 N列中的数字要求是31~45之间的任一数字 G列中的数字要求是46~60之间的任一数字 O列中的数字要求是61~75之间的任一数字 因此,我们在这里引入一个数组。通过数组来限制每列生

北北北的专栏 1205

Android-Bingo一款IT阅读学习类的开源AndroidApp

该项目使用动态代理AOP编程框架,使开发起来更简洁、更高效。

生成 Bingo 卡片

1.Bingo 卡片是什么5*5的卡片,五个列上标着B-I—N—G-O ,格子中包含1-75 的数字,正中间是一个空的格子,通常印着free每列可以包含的数字大的范围如下: B列 1~15; I列16~30; N列31~45; G列46~60; O列61~75. 不可以有重复的数字或空的格子。 2.HTML代码:<body> <h

NinthSea的博客 3455

bingo:产生一些数字来玩宾果游戏

bingo:产生一些数字来玩宾果游戏

阿里云人工智能工程师ACA认证免费课程学习笔记

阿里云人工智能工程师ACA认证免费课程学习笔记

engchina的专栏 2023

bingo卡片js代码_Excel Bingo卡随机数代码

bingo卡片js代码 Excel Bingo卡随机数代码 (Excel Bingo Card Random Number Code)A couple of years ago, I posted about an Excel bingo workbook, that you could use to create a set of three cards with random numbers....

culiao2169的博客 744

2-6-1-1 QNX编程入门之进程和线程(一)

文章围绕进程和线程展开介绍。先是将进程类比为房子,线程类比为居住者,阐述其基本概念,如进程占用内存,线程可共享内存。接着讲解同步相关内容,介绍了互斥,线程通过互斥锁来控制对特定资源的访问,像使用浴室一样。还提到优先级,线程按优先级和等待时长来决定获取资源顺序。此外,说明了信号量,以厨房为例,区分计数为 1 和大于 1 的信号情况,且指出信号量可当互斥锁用,但互斥锁是特殊用途信号量,二者存在区别,最后提及后续会介绍其他同步机制。

星原飞火的博客 1328

利用Javascript制作宾果(BINGO)游戏

Bingo游戏简介 Bingo卡片是5×5的正方形,五个列上标着B-I-N-G-O,美国的Bingo游戏格子中的数字通常在70以内随机抽取,英国和澳大利亚的是在90以内。正中间通常是一个空的格子,常常印着单词free。每列可以包含的数字范围如下: B列包含着数字1~15 I列包含着数字16~30 N列包含着数字31~45 G列包含着数...

weixin_34059951的博客 2044

MaxENT生态位模型实战:从数据准备到论文发表的完整指南

本文提供MaxENT生态位模型从数据准备到论文发表的完整实战指南,涵盖物种分布数据处理、环境变量筛选、参数优化及结果可视化等关键步骤。特别介绍如何通过R语言进行高级建模优化,提升模型AUC值,并分享海洋生物专题研究中的数据处理技巧。适合生态学研究者快速掌握这一强大的物种分布预测工具,产出高质量研究成果。

tensor9flow的博客 311

UE5 Metahuman与Blender手动绑定:ARKit面部动画实战对比

面部动画是角色动画领域的核心技术,其核心原理在于通过驱动面部骨骼或混合形状来模拟真实肌肉运动,从而赋予数字角色生命力。这项技术的价值在于极大地提升了虚拟角色的表现力与沉浸感,广泛应用于游戏开发、影视制作、虚拟现实和实时交互应用。在技术实现路径上,开发者常面临工业化集成方案与高度自定义方案的选择。本文聚焦于使用行业标准的ARKit 52个面部混合形状数据,深度对比了虚幻引擎Metahuman的工业化流程与Blender手动绑定方案在视觉保真度、工作流效率、性能开销和扩展性上的差异,为不同项目规模与技术需求的团

weixin_33901926的博客 452

Bingo卡片案例笔记【三】、随机生成数字并填写到表格中去

在前面的步骤中,我们建立生成了html和css文件。下面我们要通过javascript来随机生成1~75中的数字并填写到除“free”以外的所有表格中去。 window.onload=newCard; function newCard(){ //共有24个格子需要填入数字,所以需要循环生成24个数字填入 for(var i=0;i<24;i++) { var newNums=M

北北北的专栏 2313

保姆级教程:在RK3588平台上为IMX415 Sensor配置HDR2曝光(附完整代码与避坑点)

本文提供RK3588平台上为IMX415 Sensor配置HDR2曝光的详细教程,涵盖基础概念、限制条件、实战配置步骤及常见问题解决方案。通过完整代码示例和关键参数解析,帮助开发者高效实现HDR2曝光模式,提升图像质量并避开常见陷阱。

weixin_28685287的博客 289

javascript实现bingo游戏的数字生成

 BINGO游戏中5*5的卡片上数字是这样的:第一行5个格分别为B、I、N、G、O五个字母,下面是5行5列,通常在1-15中选择B对应的数字,16-30中选择I对应的数字,31-45中选择N对应的数字,46-60中选择G对应的数字,61-75中选择O对应的数字,而且每一类是不能重复的。 下面用js实现的该卡片上数字随机生成的过程: 一个jsp页面,用来显示卡片,代码如下: &lt;%@ pa...

yan 1160

102、栅极驱动芯片选型与设计

文章摘要 本文分享了栅极驱动芯片选型与设计的实战经验。通过一次因驱动芯片选型不当导致的炸管事故,作者总结了栅极驱动芯片选型的五个关键参数:峰值驱动电流、驱动电压范围、传播延迟匹配、欠压锁定和隔离等级。文章详细分析了自举电路设计中的常见陷阱,以及栅极电阻对开关特性的影响,并强调了PCB布局布线的重要性。最后,作者提供了七条实用建议,包括避免通用型驱动芯片、关注CMTI参数、使用插件电阻等。核心观点是:栅极驱动设计需要综合考虑参数匹配、电路布局和实际调试,示波器实测波形是验证设计的唯一标准。

2401_88858637的博客 65

25杰瑞机械工程师面试经验机械面试问题总结技巧面试全攻略

作为一个对机械工程充满热情的应届生,我有幸参加了杰瑞集团的机械工程师面试。面试过程既充满挑战,也不乏乐趣。以下是我面试的详细经历,包括面试流程、面试题目及参考答案。 #### 面试流程 1. **HR初面**:主要是对个人背景、教育经历和工作经验的初步了解。 2. **技术面**:由技术部门的主管进行,主要考察专业知识和项目经验。 3. **部门经理面**:更深入地了解我的技术能力和团队合作精神。 4. **总监终面**:最后一轮面试,总监会对候选人的整体素质进行评估。

m0_72216164的博客 2804

Javascript构建Bingo卡片游戏

预备知识点: 1、 “< table >”表示表格, “< tr >”表示表格的开始一行, “< th>”表示表格中列的标题单元格, “< td>”表示表格中的每个单元格 2、常用的字符含义 ”&nbsp“表示空格 & & < < > > " ” &qpos; ‘一、静态bingo区程序代码区: Html片段:<!DOCTYPE html>

shursulei的博客 4141

innovus:streamOut gds中pg text带有冒号(:)解决办法

streamOut后查看layout,发现部分PG text后面加了冒号,比如VDD: / VSS:。当然,这个问题还有另一种解决办法,就是通过脚本给terminal打text再streamOut。我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?

m0_61544122的博客 1197

JavaScript基础教程第8版-例1-Bingo卡片游戏

1基础工作 <h1>Create A Bingo Card</h1> <table> <tr> <th>B</th> <th>I</th> <th>N</th> <th>G</th> <th>O</th>

SanOrintea的博客 1241

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

JavaScript实现简单的Bingo卡片

HTML: Bingo Card Create a Bingo Card B I N G O                         Free

Fyn_Andersen的博客 1885

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

《JavaScript 基础教程(第6版)》第三章中的Bingo卡片程序实例

在《JavaScript 基础教程(第6版)》第三章中有一个Bingo卡片的示例程序。 规则:在 5*5 的矩形格子中,每格都存有一个随机整数,第1列数值取1-15,第2列数值取16-30,其后的列依此类推,要求所取的随机数值是没有重复所取过的。而在矩形格子中有一个空的格子,不存数值。 HTML代码如下: HTML Code<table><tr>...

dieya9669的博客 369

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

js学习日记-Bingo Card

用循环进行重复操作 例做一个Bingo Card html部分 ... <table> <tr> <td id="s0">&nbsp;</td> <td id="s5">&nbsp;</td> <td id="s10">&nbsp;</td> <td id="s14">&nbsp;</td&gt

qq_45457760的博客 678

bingo小游戏介绍以及概率问题

bingo小游戏公司年会的奖励打算用bingo小游戏的方式,通过印制一些卡片来发放奖励,最后中奖的用户来平分奖金。一、规则说明: 1、每张卡片由5*5的表格组成,格子中的数据由1-25随意不重复排列 2、数字滚动机滚动数字,主持人喊停,5个数字之后,确认没人中奖,会继续喊出第6个数字,以此类推 3、中奖要求:叫出的N个数字中,任意5个在卡片的一条线上(横、竖,对角)即中奖。二、中奖概率问题

纸上得来终觉浅 2万+

JavaScript——3:第一个应用程序

之前简单地介绍过JavaScript的一些基础知识,包括循环、函数、对象等,这里将通过一个bingo游戏的例子介绍对它们的应用。 一, 用循环进行重复操作 这个示例演示如何建立和使用循环,用随机生成的数字填充 Bingo 卡片的内容: test.html文件: <!DOCTYPE html> <html> <head> <title>Make Your Own Bingo Card</title> <link rel="styles

dangfulin的博客 251

java中的纸牌游戏_Java中的宾果纸牌游戏

我为Java中的宾果游戏创建了两种方法。一种方法创建一个新的板,根据宾果规则(1-75)用宾果板填充宾果板。我的第二种方法生成范围为1-75的随机数。public static int drawNum(){Random rand = new Random();int num = rand.nextInt(75)+1;return num;}public static void bingoCard(...

weixin_39644494的博客 302

javascrip第一个web程序

脚本3-1  这个HTML页面建立Bingo卡片的框架 Make Your Own Bingo Card Create A Bingo Card B I N G O           3.1 用循环进行重复操作   35 1

a5421901的专栏 495
上一篇: Bingo卡片案例笔记【四】、生成符合规范的数字
下一篇: css中“border”在chrome与ie中的不同
北北北
博客等级 码龄18年 1粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值