# Exercício 4 - Capítulo 7

**URL:** <https://forum.casadocodigo.com.br/t/exercicio-4-capitulo-7/2178>\
**Category:** Livros\
**Tags:** logica-programacao\
**Created:** [Abril 21, 2023, 12:12am UTC](https://forum.casadocodigo.com.br/t/exercicio-4-capitulo-7/2178 "2023-04-21T00:12:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucasDevRJ](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.casadocodigo.com.br/lucasdevrj/32/14827_2.png) [@LucasDevRJ](https://forum.casadocodigo.com.br/u/LucasDevRJ)\
**Post date:** [Abril 21, 2023, 12:12am UTC](https://forum.casadocodigo.com.br/t/exercicio-4-capitulo-7/2178/1 "2023-04-21T00:12:24Z")

</div>

Estou com dificuldade em terminar o exercício, porque não consigo desenhar o “V de Vingança” completo, segue o print:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/casadocodigo/original/2X/d/d93904c2722d8c2a3dee5bbf5aa49ae2ba29ccb2.png)

Código:

```auto
<canvas id="tela" width="800" height="400"></canvas>

<script>
	function desenhaLinhas(x, y) {
		var tela = document.getElementById("tela");
		var c = tela.getContext("2d");
		
		c.strokeStyle = "black";
		c.strokeRect(x, y, 50, 10);
	}
	
	function desenhaTrianguloBolas(x, y) {
		var tela = document.getElementById("tela");
		var c = tela.getContext("2d");
		
		c.fillStyle = "black";
		c.beginPath();
		c.arc(x, y, 25, 0, 2*3.14);
		c.fill();
	}
	
	for (var x = 0; x < 800; x = x + 50) {
		for (var y = 0; y < 400; y = y + 50) {
			if (x == y) {
				desenhaTrianguloBolas(x+25, y+25);
			} else {
				desenhaLinhas(x, y);
			}
		}
	}
	
	for (var x = 800; x > 0; x = x - 50) {
		for (var y = 400; y > 0; y = y - 50) {
			if (x == y) {
				desenhaTrianguloBolas(x+25, y+25);
			} else {
				desenhaLinhas(x, y);
			}
		}
	}
</script>

```

Alguém poderia me ajudar?
