diff --git a/docs/assets/index-eac4b37d.js b/docs/assets/index-eac4b37d.js deleted file mode 100644 index cd6dbf8..0000000 --- a/docs/assets/index-eac4b37d.js +++ /dev/null @@ -1,13 +0,0 @@ -(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))e(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&e(f)}).observe(document,{childList:!0,subtree:!0});function t(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function e(i){if(i.ep)return;i.ep=!0;const u=t(i);fetch(i.href,u)}})();var Fn="1.13.6",Pn=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},Y=Array.prototype,ln=Object.prototype,In=typeof Symbol<"u"?Symbol.prototype:null,zr=Y.push,F=Y.slice,C=ln.toString,Jr=ln.hasOwnProperty,zn=typeof ArrayBuffer<"u",Ur=typeof DataView<"u",Wr=Array.isArray,Tn=Object.keys,Sn=Object.create,Bn=zn&&ArrayBuffer.isView,Hr=isNaN,Gr=isFinite,Jn=!{toString:null}.propertyIsEnumerable("toString"),Ln=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xr=Math.pow(2,53)-1;function d(n,r){return r=r==null?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),i=0;i=0&&t<=Xr}}function bn(n){return function(r){return r==null?void 0:r[n]}}const G=bn("byteLength"),rt=kn(G);var tt=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function et(n){return Bn?Bn(n)&&!H(n):rt(n)&&tt.test(C.call(n))}const jn=zn?et:xn(!1),m=bn("length");function ut(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},Ot=hr(gr),Et=fr(gr),Nt=hr(Et),Mt=c.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,Pt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},It=/\\|'|\r|\n|\u2028|\u2029/g;function Tt(n){return"\\"+Pt[n]}var St=/^\s*(\w|\$)+\s*$/;function Bt(n,r,t){!r&&t&&(r=t),r=lr({},r,c.templateSettings);var e=RegExp([(r.escape||K).source,(r.interpolate||K).source,(r.evaluate||K).source].join("|")+"|$","g"),i=0,u="__p+='";n.replace(e,function(l,s,h,Nn,Mn){return u+=n.slice(i,Mn).replace(It,Tt),i=Mn+l.length,s?u+=`'+ -((__t=(`+s+`))==null?'':_.escape(__t))+ -'`:h?u+=`'+ -((__t=(`+h+`))==null?'':__t)+ -'`:Nn&&(u+=`'; -`+Nn+` -__p+='`),l}),u+=`'; -`;var f=r.variable;if(f){if(!St.test(f))throw new Error("variable is not a bare identifier: "+f)}else u=`with(obj||{}){ -`+u+`} -`,f="obj";u=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; -`+u+`return __p; -`;var a;try{a=new Function(f,"_",u)}catch(l){throw l.source=u,l}var o=function(l){return a.call(this,l,c)};return o.source="function("+f+`){ -`+u+"}",o}function Lt(n,r,t){r=J(r);var e=r.length;if(!e)return g(t)?t.call(n):t;for(var i=0;i1)S(a,r-1,t,e),i=e.length;else for(var o=0,l=a.length;or?(e&&(clearTimeout(e),e=null),a=s,f=n.apply(i,u),e||(i=u=null)):!e&&t.trailing!==!1&&(e=setTimeout(o,h)),f};return l.cancel=function(){clearTimeout(e),a=0,e=i=u=null},l}function zt(n,r,t){var e,i,u,f,a,o=function(){var s=$()-i;r>s?e=setTimeout(o,r-s):(e=null,t||(f=n.apply(a,u)),e||(u=a=null))},l=d(function(s){return a=this,u=s,i=$(),e||(e=setTimeout(o,r),t&&(f=n.apply(a,u))),f});return l.cancel=function(){clearTimeout(e),e=u=a=null},l}function Jt(n,r){return D(r,n)}function _n(n){return function(){return!n.apply(this,arguments)}}function Ut(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Wt(n,r){return function(){if(--n<1)return r.apply(this,arguments)}}function wr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}const Ht=D(wr,2);function _r(n,r,t){r=y(r,t);for(var e=v(n),i,u=0,f=e.length;u0?0:i-1;u>=0&&u0?f=u>=0?u:Math.max(u+a,f):a=u>=0?Math.min(u+1,a):u+a+1;else if(t&&u&&a)return u=t(e,i),e[u]===i?u:-1;if(i!==i)return u=r(F.call(e,f,a),Kn),u>=0?u+f:-1;for(u=n>0?f:a-1;u>=0&&u0?0:a-1;for(u||(i=t[f?f[o]:o],o+=n);o>=0&&o=3;return r(t,U(e,u,4),i,f)}}const x=Pr(1),Cn=Pr(-1);function B(n,r,t){var e=[];return r=y(r,t),E(n,function(i,u,f){r(i,u,f)&&e.push(i)}),e}function Qt(n,r,t){return B(n,_n(y(r)),t)}function Vn(n,r,t){r=y(r,t);for(var e=!w(n)&&v(n),i=(e||n).length,u=0;u=0}const Yt=d(function(n,r,t){var e,i;return g(r)?i=r:(r=J(r),e=r.slice(0,-1),r=r[r.length-1]),P(n,function(u){var f=i;if(!f){if(e&&e.length&&(u=dn(u,e)),u==null)return;f=u[r]}return f==null?f:f.apply(u,t)})});function On(n,r){return P(n,yn(r))}function Zt(n,r){return B(n,V(r))}function Ir(n,r,t){var e=-1/0,i=-1/0,u,f;if(r==null||typeof r=="number"&&typeof n[0]!="object"&&n!=null){n=w(n)?n:L(n);for(var a=0,o=n.length;ae&&(e=u)}else r=y(r,t),E(n,function(l,s,h){f=r(l,s,h),(f>i||f===-1/0&&e===-1/0)&&(e=l,i=f)});return e}function Kt(n,r,t){var e=1/0,i=1/0,u,f;if(r==null||typeof r=="number"&&typeof n[0]!="object"&&n!=null){n=w(n)?n:L(n);for(var a=0,o=n.length;aa||f===void 0)return 1;if(f1&&(e=U(e,r[1])),r=z(n)):(e=ue,r=S(r,!1,!1),n=Object(n));for(var i=0,u=r.length;i1&&(e=r[1])):(r=P(S(r,!1,!1),String),t=function(i,u){return!O(r,u)}),Br(n,t,e)});function Lr(n,r,t){return F.call(n,0,Math.max(0,n.length-(r==null||t?1:r)))}function k(n,r,t){return n==null||n.length<1?r==null||t?void 0:[]:r==null||t?n[0]:Lr(n,n.length-r)}function W(n,r,t){return F.call(n,r==null||t?1:r)}function fe(n,r,t){return n==null||n.length<1?r==null||t?void 0:[]:r==null||t?n[n.length-1]:W(n,Math.max(0,n.length-r))}function ae(n){return B(n,Boolean)}function le(n,r){return S(n,r,!1)}const Dr=d(function(n,r){return r=S(r,!0,!0),B(n,function(t){return!O(r,t)})}),oe=d(function(n,r){return Dr(n,r)});function en(n,r,t,e){Wn(r)||(e=t,t=r,r=!1),t!=null&&(t=y(t,e));for(var i=[],u=[],f=0,a=m(n);f{for(let n=2;n<=10;n++)for(let r of qn)_.push(n+r);for(let n of qn)for(let r of me)_.push(r+n);return _=fn.shuffle(_),console.log(_),_};$r();const qr=()=>{if(_.length===0)throw"No hay cartas en el deck";return _.pop()},Fr=n=>{const r=n.substring(0,n.length-1);return isNaN(r)?r==="A"?11:10:r*1},an=n=>{do{const r=qr();M=M+Fr(r),Q[1].innerText=M;const t=document.createElement("img");if(t.src=`assets/cartas/${r}.png`,t.classList.add("carta"),Vr.append(t),n>21)break}while(M{M===n?alert("Nadie gana :("):n>21?alert("Computadora gana"):M>21?alert("Jugador Gana"):alert("Computadora Gana")},100)};R.addEventListener("click",()=>{const n=qr();A=A+Fr(n),Q[0].innerText=A;const r=document.createElement("img");r.src=`assets/cartas/${n}.png`,r.classList.add("carta"),Cr.append(r),A>21?(console.warn("Lo siento mucho, perdiste"),R.disabled=!0,q.disabled=!0,an(A)):A===21&&(console.warn("21, genial!"),R.disabled=!0,q.disabled=!0,an(A))});q.addEventListener("click",()=>{R.disabled=!0,q.disabled=!0,an(A)});ye.addEventListener("click",()=>{console.clear(),_=[],_=$r(),A=0,M=0,Q[0].innerText=0,Q[1].innerText=0,Vr.innerHTML="",Cr.innerHTML="",R.disabled=!1,q.disabled=!1}); diff --git a/docs/assets/index-f96b70e6.js b/docs/assets/index-f96b70e6.js new file mode 100644 index 0000000..b80d280 --- /dev/null +++ b/docs/assets/index-f96b70e6.js @@ -0,0 +1,13 @@ +(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))e(u);new MutationObserver(u=>{for(const i of u)if(i.type==="childList")for(const f of i.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&e(f)}).observe(document,{childList:!0,subtree:!0});function t(u){const i={};return u.integrity&&(i.integrity=u.integrity),u.referrerPolicy&&(i.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?i.credentials="include":u.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function e(u){if(u.ep)return;u.ep=!0;const i=t(u);fetch(u.href,i)}})();var Fn="1.13.6",Pn=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},Y=Array.prototype,on=Object.prototype,Tn=typeof Symbol<"u"?Symbol.prototype:null,Hr=Y.push,$=Y.slice,C=on.toString,Jr=on.hasOwnProperty,$n=typeof ArrayBuffer<"u",Ur=typeof DataView<"u",Wr=Array.isArray,In=Object.keys,Sn=Object.create,Bn=$n&&ArrayBuffer.isView,Gr=isNaN,Xr=isFinite,zn=!{toString:null}.propertyIsEnumerable("toString"),Ln=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Qr=Math.pow(2,53)-1;function d(n,r){return r=r==null?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u=0&&t<=Qr}}function kn(n){return function(r){return r==null?void 0:r[n]}}const G=kn("byteLength"),tt=xn(G);var et=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function ut(n){return Bn?Bn(n)&&!W(n):tt(n)&&et.test(C.call(n))}const bn=$n?ut:Kn(!1),m=kn("length");function it(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},Ot=hr(pr),Nt=ir(pr),Mt=hr(Nt),Pt=c.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,Tt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},It=/\\|'|\r|\n|\u2028|\u2029/g;function St(n){return"\\"+Tt[n]}var Bt=/^\s*(\w|\$)+\s*$/;function Lt(n,r,t){!r&&t&&(r=t),r=ar({},r,c.templateSettings);var e=RegExp([(r.escape||K).source,(r.interpolate||K).source,(r.evaluate||K).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(o,s,p,Nn,Mn){return i+=n.slice(u,Mn).replace(It,St),u=Mn+o.length,s?i+=`'+ +((__t=(`+s+`))==null?'':_.escape(__t))+ +'`:p?i+=`'+ +((__t=(`+p+`))==null?'':__t)+ +'`:Nn&&(i+=`'; +`+Nn+` +__p+='`),o}),i+=`'; +`;var f=r.variable;if(f){if(!Bt.test(f))throw new Error("variable is not a bare identifier: "+f)}else i=`with(obj||{}){ +`+i+`} +`,f="obj";i=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; +`+i+`return __p; +`;var a;try{a=new Function(f,"_",i)}catch(o){throw o.source=i,o}var l=function(o){return a.call(this,o,c)};return l.source="function("+f+`){ +`+i+"}",l}function Dt(n,r,t){r=H(r);var e=r.length;if(!e)return g(t)?t.call(n):t;for(var u=0;u1)I(a,r-1,t,e),u=e.length;else for(var l=0,o=a.length;lr?(e&&(clearTimeout(e),e=null),a=s,f=n.apply(u,i),e||(u=i=null)):!e&&t.trailing!==!1&&(e=setTimeout(l,p)),f};return o.cancel=function(){clearTimeout(e),a=0,e=u=i=null},o}function Ht(n,r,t){var e,u,i,f,a,l=function(){var s=q()-u;r>s?e=setTimeout(l,r-s):(e=null,t||(f=n.apply(a,i)),e||(i=a=null))},o=d(function(s){return a=this,i=s,u=q(),e||(e=setTimeout(l,r),t&&(f=n.apply(a,i))),f});return o.cancel=function(){clearTimeout(e),e=i=a=null},o}function Jt(n,r){return D(r,n)}function _n(n){return function(){return!n.apply(this,arguments)}}function Ut(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Wt(n,r){return function(){if(--n<1)return r.apply(this,arguments)}}function yr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}const Gt=D(yr,2);function wr(n,r,t){r=y(r,t);for(var e=v(n),u,i=0,f=e.length;i0?0:u-1;i>=0&&i0?f=i>=0?i:Math.max(i+a,f):a=i>=0?Math.min(i+1,a):i+a+1;else if(t&&i&&a)return i=t(e,u),e[i]===u?i:-1;if(u!==u)return i=r($.call(e,f,a),Zn),i>=0?i+f:-1;for(i=n>0?f:a-1;i>=0&&i0?0:a-1;for(i||(u=t[f?f[l]:l],l+=n);l>=0&&l=3;return r(t,J(e,i,4),u,f)}}const x=Mr(1),Cn=Mr(-1);function B(n,r,t){var e=[];return r=y(r,t),E(n,function(u,i,f){r(u,i,f)&&e.push(u)}),e}function Yt(n,r,t){return B(n,_n(y(r)),t)}function Vn(n,r,t){r=y(r,t);for(var e=!w(n)&&v(n),u=(e||n).length,i=0;i=0}const Zt=d(function(n,r,t){var e,u;return g(r)?u=r:(r=H(r),e=r.slice(0,-1),r=r[r.length-1]),M(n,function(i){var f=u;if(!f){if(e&&e.length&&(i=dn(i,e)),i==null)return;f=i[r]}return f==null?f:f.apply(i,t)})});function En(n,r){return M(n,yn(r))}function Kt(n,r){return B(n,V(r))}function Pr(n,r,t){var e=-1/0,u=-1/0,i,f;if(r==null||typeof r=="number"&&typeof n[0]!="object"&&n!=null){n=w(n)?n:L(n);for(var a=0,l=n.length;ae&&(e=i)}else r=y(r,t),E(n,function(o,s,p){f=r(o,s,p),(f>u||f===-1/0&&e===-1/0)&&(e=o,u=f)});return e}function xt(n,r,t){var e=1/0,u=1/0,i,f;if(r==null||typeof r=="number"&&typeof n[0]!="object"&&n!=null){n=w(n)?n:L(n);for(var a=0,l=n.length;aa||f===void 0)return 1;if(f1&&(e=J(e,r[1])),r=z(n)):(e=ie,r=I(r,!1,!1),n=Object(n));for(var u=0,i=r.length;u1&&(e=r[1])):(r=M(I(r,!1,!1),String),t=function(u,i){return!A(r,i)}),Sr(n,t,e)});function Br(n,r,t){return $.call(n,0,Math.max(0,n.length-(r==null||t?1:r)))}function k(n,r,t){return n==null||n.length<1?r==null||t?void 0:[]:r==null||t?n[0]:Br(n,n.length-r)}function U(n,r,t){return $.call(n,r==null||t?1:r)}function ae(n,r,t){return n==null||n.length<1?r==null||t?void 0:[]:r==null||t?n[n.length-1]:U(n,Math.max(0,n.length-r))}function oe(n){return B(n,Boolean)}function le(n,r){return I(n,r,!1)}const Lr=d(function(n,r){return r=I(r,!0,!0),B(n,function(t){return!A(r,t)})}),ce=d(function(n,r){return Lr(n,r)});function en(n,r,t,e){Jn(r)||(e=t,t=r,r=!1),t!=null&&(t=y(t,e));for(var u=[],i=[],f=0,a=m(n);f{if(!n||n===0)throw new Error("TiposDeCarta es obligatorio");if(!r||r===0)throw new Error("tiposEspeciales es obligatorio");let t=[];for(let e=2;e<=10;e++)for(let u of n)t.push(e+u);for(let e of n)for(let u of r)t.push(u+e);return t=fn.shuffle(t),t},Cr=n=>{if(!n||n.length===0)throw"No hay cartas en el deck";return n.pop()},an=(n,r,t,e=[])=>{if(!n)throw new Error("Puntos Minimos son necesarios");if(!r)throw new Error("Argumento HTML es necesarios");let u=0;do{const i=Cr(e);u=u+Vr(i),r.innerText=u;const f=qr(i);if(t.append(f),n>21)break}while(u{u===n?alert("Nadie gana :("):n>21?alert("Computadora gana"):u>21?alert("Jugador Gana"):alert("Computadora Gana")},100)},Vr=n=>{const r=n.substring(0,n.length-1);return isNaN(r)?r==="A"?11:10:r*1},qr=n=>{if(!n)throw new Error("La carta es necesaria");const r=document.createElement("img");return r.src=`assets/cartas/${n}.png`,r.classList.add("carta"),r};let N=[];const Fr=["C","D","H","S"],$r=["A","J","Q","K"];let _=0;const R=document.querySelector("#btnPedir"),F=document.querySelector("#btnDetener"),ye=document.querySelector("#btnNuevo"),zr=document.querySelector("#jugador-cartas"),Q=document.querySelector("#computadora-cartas"),S=document.querySelectorAll("small");N=Rr(Fr,$r);R.addEventListener("click",()=>{const n=Cr(N);_=_+Vr(n),S[0].innerText=_;const r=qr(n);zr.append(r),_>21?(console.warn("Lo siento mucho, perdiste"),R.disabled=!0,F.disabled=!0,an(_,S[1],Q,N)):_===21&&(console.warn("21, genial!"),R.disabled=!0,F.disabled=!0,an(_,S[1],Q,N))});F.addEventListener("click",()=>{R.disabled=!0,F.disabled=!0,an(_,S[1],Q,N)});ye.addEventListener("click",()=>{console.clear(),N=[],N=Rr(Fr,$r),_=0,S[0].innerText=0,S[1].innerText=0,Q.innerHTML="",zr.innerHTML="",R.disabled=!1,F.disabled=!1}); diff --git a/docs/index.html b/docs/index.html index d0e7d36..b689f5c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,12 +2,12 @@ - + Blackjack - - + + diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..94fbd28 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,5 @@ +import {defineConfig} from 'vite'; + +export default defineConfig({ + base: '/js-blackjack-vite/', +}); \ No newline at end of file