Filter löschen
Filter löschen

simple version of minesweeper

1 Ansicht (letzte 30 Tage)
C Hart
C Hart am 4 Okt. 2016
As an assignment I need to make a program or 'game' like minesweeper. We will use several layers to build up the game. Can anyone explain to me how I make a 10 x 10 matrix with blocks filled with only grey, and gridlines on either side.
unclicked = zeros (10,10) - 1; % clicked buttons are -1
unclicked_gray = 0.8 * [1 1 1];
clicked = ones (10,10) - 1; % clicked buttons are 0
clicked_gray = 0.5 * [1 1 1];
clf;
unclicked_matrix(10,10,1:3) = [
0.5 0.5 0.5
];
image(unclicked_matrix)
axis off;
grid on;
I am trying something with this, however I don't know how to combine the variables and whether the variables are even usefull. The image I fill in only shows a few grey blocks and I don't know why. Thank you in advance!
  1 Kommentar
Gopichandh Danala
Gopichandh Danala am 4 Okt. 2016
Bearbeitet: Gopichandh Danala am 4 Okt. 2016
Do you mean something like a black image with a grid boundary around it in a different color? if so try this..
tab = ones(10,10)*0.5;
tab(:,1) = 1;
tab(:,10) = 1;
tab(1,:) = 1;
tab(10,:) = 1;
figure, imshow(tab,'InitialMagnification','fit');

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Strategy & Logic finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by