90 likes | 276 Vues
This MATLAB-based Nerd Bingo Card Generator allows users to generate unique bingo cards filled with random numbers. The board is initialized, with each cell filled with a unique number from 1 to 75. Users can pick numbers, and the program checks for called numbers and user responses. The generator reads member names for an interactive experience and ensures that numbers are placed without repetition. This is an ideal tool for events, gatherings, or educational purposes among students and enthusiasts alike!
E N D
nested loop to initiate Bingo board START k = 0; for i=1:5 0 1 0 for j=1:15 1 k = k + 1; board(j,i)=k; called(j,i)=0; END
pick a “ball” from the Bingo board START pick = 0; 0 while pick == 0 1 pick_col = ceil(rand()*5); pick_row = ceil(rand()*15); number = board(pick_row, pick_col); if called(pick_row,pick_col) == 0 0 1 called(pick_row,pick_col)=number; pick = 1; END count = count + 1;
check user response Y or N START response = 1; while response 0 1 check=input('Y/N\n','s'); 1 if check==Y|N 0 invalid input response = 0; END
Nerd Bingo Card Generator DATA START READ 0 for k=1:n 1 ZEROS FILL PRINT END
aiche.txt START members = textread() read member names n = size(members) READ names = strvcat(members) END
fill card with zeros START ZEROS 0 for i=1:5 1 i=i+1 for j=1:5 0 1 j=j+1 card(j,i)=0 END card = 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
fill card with numbers FILL START bingo = 0; 0 for i=1:5 1 i=i+1 PRINT bingo = bingo + 15 for j=1:5 0 1 j=j+1 NMSU AIChE Student Chapter Official Nerd Bingo Card B I N G O 5 21 43 52 65 3 23 41 46 74 14 18 37 50 68 12 25 32 59 69 7 16 33 58 70 Polly Darton -------- cut here -------- PICK END
place a number in position (i,j) without repetition START number = 1; PICK while number 0 1 number = bingo + ceil(rand()*15); if sum(card(:)==number)==0 0 1 card(i,j) = number; number = 0; END