How do I display a battleship board game?

2 vues (au cours des 30 derniers jours)
Aman Kumar
Aman Kumar le 8 Jan 2022
I'm designing a battleship game with two 6-by-6 game boards for the player and a computer, and each grid needs to have be numbered 1-36, so how can I do that please?
  1 commentaire
John D'Errico
John D'Errico le 8 Jan 2022
Modifié(e) : Image Analyst le 9 Jan 2022
Surely, before you post multiple new questions about basic problems in this project, you should look at the dozens of questions posted by your classmates over the last few weeks about battleship. You might learn something from them. Click on the battleship tag on the right side of this page.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 8 Jan 2022
image([0.5 5.5], [0.5 5.5], ones(6,6,3));
xticks(0:6); xticklabels([]);
yticks(0:6); yticklabels([]);
grid on
[X,Y] = ndgrid(0.5:5.5, 0.5:5.5);
text(X(:), Y(:), string(1:36))
  2 commentaires
Aman Kumar
Aman Kumar le 8 Jan 2022
How do I place multiple battleships on there,one 1x2,two 1x3, one 1x4, one 1x5

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Strategy & Logic dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by