elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 33
111  Programación / Programación General / Re: Maquina de turing explicacion sencilla en: 5 Agosto 2016, 01:31 am
hice un paper sobre este tema "maquina de turing" es muy importante conocer la importancia

cuando llegue a casa lo posteo...
112  Programación / Scripting / redes neuronales en: 1 Agosto 2016, 19:32 pm
alguien tiene el libro un buen libro de rna??? se lo agradeceria mucho si me pasa el link
113  Programación / Desarrollo Web / Re: Proyectos web en: 1 Agosto 2016, 03:22 am
Código
  1. var canva, enemigo, int,nuevo=0, enemigoA;
  2.  
  3. function main() {
  4. canva = document.getElementById("mycanvas");
  5. ctx.fillStyle="indianred";
  6.  
  7. ctx.fillRect(0,0,700,500);
  8. ctx.fillStyle="#522626";
  9. ctx.fillRect(0,0,700,50);
  10. Juego();
  11. }
  12.  
  13. window.onkeyup = function (event) {
  14. controlTeclas(event, false);
  15. }
  16.  
  17. function Punto(x,y) {
  18. this.x = x;
  19. this.y = y;
  20. }
  21. function enemigoBorder(k,l){
  22. this.k=k;
  23. this.l=l;
  24. }
  25.  
  26. function Enemigo(x,y,movx,movy) {
  27. this.x = x;
  28. this.y = y;
  29. this.movx = movx;
  30. this.movy = movy;
  31. }
  32.  
  33. function Juego() {
  34. x = 0;
  35. y = 50;
  36. k=14;
  37. l=50;
  38. dir = -1;
  39. movimiento = 0;
  40.  
  41. camino = new Array();
  42. enlinea = 1;
  43. area = new Array();
  44. area[0] = new Punto(0,50);
  45. area[1] = new Punto(700,50);
  46. area[2] = new Punto(700,498);
  47. area[3] = new Punto(0,498);
  48.  
  49. direccion = new Array(false, false, false, false);
  50.  
  51. window.clearInterval(int);
  52. int=setInterval("dibujar()", 30);
  53.  
  54. window.onkeydown = function (e) {
  55. controlTeclas(e, true);
  56. };
  57. if(Math.random()<0.5){
  58. sx = -2;
  59. sy = -2;
  60. }else{
  61. sx = 2;
  62. sy = 2;
  63. }
  64. enemigo = new Enemigo(300, 200, sx, sy);
  65. pat = ctx.createPattern(canva, "repeat");
  66.  
  67. }
  68.  
  69. function dibujar() {
  70. var i,j;
  71.  
  72.  
  73. if(nuevo==0){
  74. ctx.clearRect(200,0,250,30);
  75. ctx.font="25px Arial";
  76. ctx.fillText("   ATrott * * * 100 %" ,200,20);
  77. }
  78.  
  79. movimiento = 0;
  80. od = dir;
  81. for(i in direccion) {
  82. if(direccion[i]) {
  83. dir = Number(i);
  84. movimiento = 1;
  85. }
  86. }
  87. if(movimiento) {
  88. if(! revisarLinea(area,x,y)) {
  89. if((od+1)%4==dir||od==(dir+1)%4) {
  90. camino.push(new Punto(x,y))
  91. }
  92. }
  93. }
  94.  
  95. if(movimiento==1) {
  96. ox = x; oy = y;
  97. if(dir==0)
  98. y+=-4;
  99. if(dir==1)
  100. x+=4;
  101. if(dir==2)
  102. y+=4;
  103. if(dir==3)
  104. x+=-4;
  105.  
  106. if(revisarLinea(area,x,y))
  107. {
  108. if(enlinea==0) {
  109. if(camino[0].x==x&&camino[0].y==y) {
  110. camino = new Array();
  111. } else {
  112.  
  113. camino.push(new Punto(x,y));
  114. a = cortar(area, camino);
  115. areax = cuadrado(a[0]);
  116. areay = cuadrado(a[1]);
  117. nuevo=1;
  118. if(areax>areay) {
  119. ctx.clearRect(200,0,250,30);
  120. ctx.font="25px Arial";
  121. ctx.fillText("   ATrott * * *" + Math.floor((areax*100)/630000)+ " %",200,20);
  122. area = a[0];
  123. this.harea = a[1];
  124. if(areax<50000) {
  125. mensaje("ganaste");
  126. }
  127. } else {
  128. ctx.clearRect(200,0,250,30);
  129. ctx.font="25px Arial";
  130. ctx.fillText("    ATrott * * *" + Math.floor((areay*100)/630000)+ " %",200,20);
  131. area = a[1];
  132. this.harea = a[0];
  133. if(areay<50000) {
  134. mensaje("ganaste");
  135. }
  136. }
  137.  
  138. var ne=0;
  139. ex = enemigo.x;
  140. ey = enemigo.y;
  141. if(  inArea(ex,ey) || revisarLinea(area, ex,ey)) {
  142. ne=enemigo;
  143. }
  144.  
  145. if(ne==0)
  146. mensaje("ganaste");
  147. camino = new Array();
  148. }
  149.  
  150.  
  151.  
  152.  
  153. }
  154. enlinea = 1;
  155. camino[0] = new Punto(x,y);
  156. } else {
  157. if(enlinea == 1) {
  158. if(inArea(x,y)) {
  159. enlinea = 0;
  160. } else {
  161. x = ox; y = oy; movimiento = 0;
  162. }
  163. } else {
  164. ax = camino[0].x;
  165. ay = camino[0].y;
  166. for(i=1;i<camino.length-2;i++) {
  167. bx = camino[i].x;
  168. by = camino[i].y;
  169. if(unalinea(ax, ay,bx,by,x,y)) {
  170. camino = camino.slice(0, i);
  171. camino.push(new Punto(x,y));
  172. }
  173.  
  174. ax = bx; ay = by;
  175. }
  176.  
  177. }
  178. }
  179. }
  180.  
  181. if(enlinea==0) {
  182. ax = camino[0].x;
  183. ay = camino[0].y;
  184. for(i=1;i<camino.length;i++) {
  185. bx = camino[i].x; by = camino[i].y;
  186. if(unalinea(ax, ay,bx,by,enemigo.x,enemigo.y)) {
  187. mensaje("perdiste");
  188. }
  189. ax = bx; ay = by;
  190. }
  191. if(unalinea(ax, ay,x,y,enemigo.x,enemigo.y)) {
  192. mensaje("perdiste");
  193.  
  194. }
  195.  
  196. }
  197.  
  198. ctx.fillStyle=pat;
  199. ctx.strokeStyle="yellow";
  200. dibujarArea(area);
  201.  
  202. ctx.beginPath() //linea trazada
  203. for ( cam in camino) {
  204. ctx.lineTo(camino[cam].x,camino[cam].y)
  205. }
  206. ctx.lineTo(x,y)
  207. ctx.stroke()
  208.  
  209. ctx.fillStyle="rgb(0,0,0)";
  210. ctx.beginPath();
  211. ctx.fillRect(x,y,10,10);
  212. ctx.closePath();
  213. ctx.fill();
  214.  
  215. ex = enemigo.x+enemigo.movx;
  216. ey = enemigo.y+enemigo.movy;
  217. enemigo.x = ex;
  218. enemigo.y = ey;
  219. ax = area[area.length-1].x;
  220. ay = area[area.length-1].y;
  221. for(j in area) {
  222. bx = area[j].x; by = area[j].y;
  223. if(unalinea(ax, ay,bx,by,ex,ey)) {
  224. if(ax==bx) {
  225. enemigo.movx = - enemigo.movx;
  226. }
  227. if(ay==by) {
  228. enemigo.movy = - enemigo.movy;
  229. }
  230. }
  231. ax = bx; ay = by;
  232. }
  233. ctx.beginPath();
  234. ctx.fillRect(ex,ey,30,30);
  235. ctx.closePath();
  236. ctx.fill();
  237.  
  238. ctx.beginPath();
  239. ctx.fillRect(k,l,100,5);
  240. ctx.closePath();
  241. ctx.fill();
  242. k++;
  243. if(x>=k){
  244. l++;
  245.  
  246. }
  247. }
  248.  
  249.  
  250. function cuadrado(area) {
  251. var s = 0;
  252. ax = area[0].x;
  253. ay = area[0].y;
  254. bx = area[1].x;
  255. by = area[1].y;
  256. for(i=2;i<area.length;i++) {
  257. cx = area[i].x; cy = area[i].y;
  258. if(bx == cx) {
  259. s += (bx-ax)*(cy-by);
  260. } else {
  261. s += (by-ay)*(bx-cx);
  262. }
  263. op=cx; ol=cy;
  264. bx = cx; by = cy;
  265. ctx.fillRect(op,ol,ax,ay);
  266.  
  267. }
  268. return Math.abs(s);
  269. }
  270.  
  271. function inArea(x,y) {
  272. ax = area[area.length-1].x;
  273. ay = area[area.length-1].y;
  274. peri = 0;
  275. for(ar in area) {
  276. bx = area[ar].x;
  277. by = area[ar].y;
  278. if(ay==by && ay<=y) {
  279. if (ax>=x && bx<x || ax<x && bx>=x) {
  280. peri += 1;
  281. }
  282. }
  283. ax = bx; ay = by;
  284. }
  285. return peri%2==1;
  286. }
  287.  
  288. function controlTeclas(event, valorB) {
  289. var clave = event.keyCode;
  290. if(clave==38)
  291. direccion[0] = valorB;
  292. if(clave==39)
  293. direccion[1] = valorB;
  294. if(clave==40)
  295. direccion[2] = valorB;
  296. if(clave==37)
  297. direccion[3] = valorB;
  298. }
  299.  
  300. function mensaje(arg) {
  301. window.clearInterval(int);
  302. ctx.clearRect(200,0,250,30);
  303. ctx.fillText("      ***"+arg+"***" ,200,20);
  304.  
  305. }
  306.  
  307. function dibujarArea(area) {
  308. ctx.beginPath();
  309. for ( i in area) {
  310. ctx.lineTo(area[i].x,area[i].y);
  311. }
  312. ctx.closePath();
  313. ctx.fill();
  314. ctx.stroke();
  315. }
  316.  
  317. function cortar(area, camino) {
  318. var area1 = new Array();
  319. var area2 = new Array();
  320. var puntoFinal = new Array();
  321. puntoFinal[0] = camino[0];
  322. puntoFinal[1] = camino[camino.length-1];
  323. for(j in puntoFinal) {
  324. ax = area[area.length-1].x; ay = area[area.length-1].y;
  325. for(i in area) {
  326. bx = area[i].x; by = area[i].y;
  327. if(ax==puntoFinal[j].x&&ay==puntoFinal[j].y){
  328. break;
  329. }
  330. if(unalinea(ax,ay,bx,by,puntoFinal[j].x,puntoFinal[j].y)) {
  331. area.splice(Number(i), 0, puntoFinal[j]);
  332. break;
  333. }
  334. ui=ax; uo=ay;
  335. ax = bx; ay = by;
  336. ctx.fillRect(ui,uo,ax,ay);
  337. }
  338. }
  339. i = 0;
  340. for(e=0;e<=2;) {
  341. bx = area[i].x; by = area[i].y;
  342. switch(e) {
  343. case 0:
  344. if(bx==puntoFinal[0].x&&by==puntoFinal[0].y) {
  345. e = 1;
  346. area1 = camino.slice(0);
  347. area1.shift();
  348. area2 = camino.slice(0);
  349. area2.reverse();
  350. area2.shift();
  351. }
  352. break;
  353. case 1:
  354. if(bx==puntoFinal[1].x&&by==puntoFinal[1].y) {
  355. e = 2;
  356. }
  357. area2.push(area[i]);
  358. break;
  359. case 2:
  360. if(bx==puntoFinal[0].x&&by==puntoFinal[0].y) {
  361. e=3;
  362. }
  363. area1.push(area[i]);
  364. }
  365. i = (i+1)%area.length;
  366. }
  367.  
  368. var areas = new Array(area1, area2);
  369. return areas;
  370. }
  371.  
  372. function caminoEnBordesEnemy(areaCamino){
  373.  
  374. k++;
  375.  
  376.  
  377. }
  378.  
  379. function revisarLinea(area,x,y) {
  380. var i;
  381. ax = area[area.length-1].x;
  382. ay = area[area.length-1].y;
  383. for(i in area) {
  384. bx = area[i].x; by = area[i].y;
  385. if(unalinea(ax, ay,bx,by,x,y))
  386. return true;
  387. ax = bx; ay = by;
  388. }
  389. return false;
  390. }
  391.  
  392. function unalinea(ax,ay,bx,by,x,y) {
  393. if(x==ax&&x==bx) {
  394. if((y>=ay&&y<=by)||(y>=by&&y<=ay)) {
  395. return true;
  396. }
  397. } else if(y==ay&&y==by) {
  398. if((x>=ax&&x<=bx)||(x>=bx&&x<=ax)) {
  399. return true;
  400. }
  401. }
  402. return false;
  403. }
  404.  
  405.  
  406.  


Código
  1. <!DOCTYPE HTML>
  2. <script src="st.js"></script>
  3. <link rel="stylesheet" type="text/css" href="style.css">
  4. <title>JUEGO STIX</title>
  5.  
  6. </head>
  7.  
  8. <body onload="main()" >
  9. <h1>--- JUEGO STIX --- </h1>
  10. <canvas id="mycanvas" width="700" height="500"></canvas>
  11.  
  12. var canvas = document.getElementById('mycanvas');
  13. var ctx = canvas.getContext("2d");
  14. <footer> --autor:[rn3w]-- todos los derechos reservados</footer>
  15. </body>
  16.  
  17. </html>


Código
  1. body{
  2. width: 1000px;
  3. margin: 50px 300px;
  4. background-color: #C4C0DC;
  5. }
  6. #mycanvas{
  7. border-style: solid;
  8.  
  9. box-shadow: 19px 11px 26px 3px rgba(0,0,0,0.66);
  10. }
  11.  

autor [rn3w]

quería compartirles este trabajo que hice... es muy interesante... saludos...
114  Programación / Desarrollo Web / Re: desarrollo web con python sin framework en: 31 Julio 2016, 23:14 pm
creo que se complica la cosa si no uso ningun frame, asi que utilizare nomas gracias
115  Programación / Desarrollo Web / desarrollo web con python sin framework en: 31 Julio 2016, 21:28 pm
soy nuevo con python, se puede web sin framework, supongo que si pero como, vengo de java, php?
116  Programación / Scripting / Re: Error en importar modulo en: 31 Julio 2016, 00:59 am
ok gracias funciono perfectamente!!!
117  Programación / Scripting / Re: Error en importar modulo en: 30 Julio 2016, 18:40 pm
instale con
Citar
pip install scipy

y me sale este error




gracias por la ayuda
118  Programación / Scripting / Error en importar modulo en: 30 Julio 2016, 16:22 pm
me sale este error




que tengo que instalar, como lo soluciono?


119  Programación / Java / Re: colgar un paper en: 29 Julio 2016, 18:21 pm
me refiero a que quiero publicar un paper que hice, pero me surgio la duda, si lo puedo publicar en un sitio mas serio, por decir la ACM el cual es lo mejor de lo mejor

pero como publicar en la ACM ?

saludos...
120  Foros Generales / Foro Libre / Re: ¿Que pasa en esta página? en: 29 Julio 2016, 14:02 pm
hola andaluz me pasas la pagina por privado porfavor!!!


gracias...
Páginas: 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 33
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines