-
Notifications
You must be signed in to change notification settings - Fork 3
/
index-min.html
17 lines (17 loc) · 13.1 KB
/
index-min.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<meta charset=utf-8><body bgcolor=0 style=margin:0><canvas id=$ width=1200 height=650 style="cursor:pointer;background:#75D1FF;background:radial-gradient(#75D1FF 50%,#3591bF)"></canvas><button onclick='window.open("http://twitter.com/home?status=I played the @js13kgames game GeoQuiz by @MaximeEuziere. My score: " + (A + 1) + "levels, " + r + "km. Play here: http://xem.github.io/JS13k15")'style="display:none;position:absolute;top:570px;left:530px"id=Z>Tweet your score!</button><script>g="Cape canaveralChrist the redeemerThe great chinese wallThe great sphinxThe eiffel towerTower of pisaMount everestSagrada familiaBig benThe statue of libertyForbidden cityThe pyramids of gizaThe palace of versaillesAcropolisTrevi fountainKremlinLoch nessAtomiumLascaux cavesMont st. michelPiazza san marcoThe grand canyonMillau bridgeRock of gibraltarThe empire state buildingHollywood signTimes squareLouvre museumWhite houseFlorence cathedralLas vegasMadrid palaceCentral parkSistine chapelPiazza del campo1Machu picchuThe burj al arab hotelSt. peter's cathedralKilimanjaroCapitol hillLuxor templeGolden gate bridgeBurj khalifaAlcatrazEphesusManneken pisMount eden craterNorth capeSt. basil's cathedralVictoria fallsThe great buddhaLotus templeThe colosseumAbu simbelPetronas twin towersYellowstoneNiagara fallsThe taj mahalMount fujiMeccaAuschwitzStonehengeMount rushmorePentagonCape of good hopeOpera houseParc guellPompeiiDead sea1WaterlooEaster islandEvergladesCloud gateRialto bridgeWillis towerLittle mermaidTower bridgeThe blue mosqueNevado mismiTable mountainMinaret of jamAngkor watFaisal mosqueNeuschwanstein castleGolden temple of amritsarAl aqsa mosqueTemple of besakihChichen itzaBran castleHagia sophiaUluruBrandenburg gateBlue domed churchTaal lakeCheyenne mountainKiyomizu-deraPetraTombouctouKultury i nauki palace0AlgiersBuenos airesCanberraViennaBrusselsBrasiliaSofiaOttawaSantiagoBeijingZagrebHavanaPragueCopenhagenQuitoCairoTallinnHelsinkiParisBerlinAthensBudapestReykjavikNew delhiJakartaTehranBaghdadDublinJerusalemRomeKingstonTokyoBeirutVilniusLuxembourgSkopjeAntananarivoMexico cityMonacoRabatKathmanduAmsterdamWellingtonPyongyangOsloRamallahAsunci\u00f3nLimaManilaWarsawLisbonBucharestDohaMoscowRiyadhSingaporeBratislavaLjubljanaPretoriaSeoulMadridStockholmBernTaipeiTunisAnkaraKyivMontevideoAbu dhabiLondonWashington d.c.CaracasVatican cityHanoiGeorgetownTripoli1KabulAndorra la vellaTiranaMinskSarajevoOuagadougouYaound\u00e9BanguiBrazzavilleKinshasaYamoussoukroSan joseBogot\u00e1La pazPraiaNicosiaPorto-novoPhnom penhRoseauSanto domingoMalaboGuatemala cityPort-au-princeTegucigalpaAmmanAstanaPristinaKuwait cityVientianeNairobiKuala lumpurBamakoVallettaChisinauIslamabadPanama citySan marinoDakarBelgradeVictoriaMogadishuSri jayawardenepura kotteKhartoumDodomaBangkokSana'aHarare1Saint john'sYerevanBakuLuandaNassauManamaDhakaBridgetownBelmopanThimphuGaboroneBandar seri begawanBujumburaN'djamenaMoroniDjiboutiSan salvadorAsmaraAddis ababaSuvaLibrevilleBanjulTbilisiAccraSt. george'sConakryBissauSouth tarawaBishkekRigaMaseruMonroviaVaduzLilongweMaleMajuroNouakchottPort louisPalikirUlaanbaatarPodgoricaMaputoNaypyidawWindhoekYaren districtManaguaNiameyAbujaMuscatNgerulmudPort moresbyKigaliBasseterreCastriesKingstownApiaS\u00e3o tom\u00e9FreetownHoniaraJubaParamariboMbabaneDamascusDushanbeDiliLom\u00e9Nuku'alofaPort of spainAshgabatFunafutiKampalaTashkentPort vilaLusakaZZZZ0HonoluluJuneauOlympiaCarson citySanta feAlbanyTallahasseeSpringfieldColumbusProvidenceColumbiaAustinSalt lake cityRichmondCharlestonHarrisburgBostonRaleighMontgomerySacramentoDenverAtlantaLansing1BismarckHelenaLincolnPhoenixLittle rockConcordTrentonHartfordDoverOklahoma cityBoiseSalemIndianapolisDes moinesTopekaPierreFrankfortNashvilleBaton rougeAugustaAnnapolisMontpelierSt. paulJacksonMadisonJefferson cityCheyenne0AlgeriaArgentinaAustraliaAustriaBelgiumBrazilBulgariaCanadaChileChinaCroatiaCubaCzech republicDenmarkEcuadorEgyptEstoniaFinlandFranceGermanyGreeceHungaryIcelandIndiaIndonesiaIranIraqIrelandIsraelItalyJamaicaJapanLebanonLithuaniaLuxembourgMacedoniaMadagascarMexicoMonacoMoroccoNepalNetherlandsNew zealandNorth koreaNorwayPalestineParaguayPeruPhilippinesPolandPortugalRomaniaQatarRussiaSaudi arabiaSingaporeSlovakiaSloveniaSouth africaSouth koreaSpainSwedenSwitzerlandTaiwanTunisiaTurkeyUkraineUruguayUnited arab emiratesUnited kingdomU.s.a.VenezuelaVatican cityVietnamGuyanaLibya1AfghanistanAndorraAlbaniaBelarusBosnia and herzegovina Burkina fasoCameroonCentral african republicRepublic of the congo Democratic republic of the congo Cote d'ivoireCosta ricaColombiaBoliviaCabo verdeCyprusBeninCambodiaDominicaDominican republicEquatorial guineaGuatemalaHaitiHondurasJordanKazakhstanKosovoKuwaitLaosKenyaMalaysiaMaliMaltaMoldovaPakistanPanamaSan marinoSenegalSerbiaSeychellesSomaliaSri lankaSudanTanzaniaThailandYemenZimbabwe1Antigua and barbudaArmeniaAzerbaijanAngolaBahamasBahrainBangladeshBarbadosBelizeBhutanBotswanaBruneiBurundiChadComorosDjiboutiEl salvadorEritreaEthiopiaFijiGabonGambiaGeorgiaGhanaGrenadaGuineaGuinea-bissauKiribatiKyrgyzstanLatviaLesothoLiberiaLiechtensteinMalawiMaldivesMarshall islandsMauritaniaMauritiusMicronesiaMongoliaMontenegroMozambiqueMyanmarNamibiaNauruNicaraguaNigerNigeriaOmanPalauPapua new guineaRwandaSaint kitts and nevisSaint luciaSaint vincent and the grenadinesSamoaSao tome and principeSierra leoneSolomon islandsSouth sudanSurinameSwazilandSyriaTajikistanTimor-lesteTogoTongaTrinidad and tobagoTurkmenistanTuvaluUgandaUzbekistanVanuatuZambia1ZZZZ0HawaiiAlaskaWashingtonNevadaNew mexicoNew yorkFloridaIllinoisOhioRhode islandSouth carolinaTexasUtahVirginiaWest virginiaPennsylvaniaMassachusettsNorth carolinaAlabamaCaliforniaColoradoGeorgiaMichigan1North dakotaMontanaNebraskaArizonaArkansasNew hampshireNew jerseyConnecticutDelawareOklahomaIdahoOregonIndianaIowaKansasSouth dakotaKentuckyTennesseeLouisianaMaineMarylandVermontMinnesotaMississippiWisconsinMissouriWyoming1ZZ".split(0);
h=$.getContext("2d");m=Math;o=n=0;p=5E4;q=3E4;r=0;s=[];for(i=0;300>i;i++)s[i]=[1200*m.random(),650*m.random(),m.random()+.5];t=function(l,F,J,R,U,G){h.textAlign=G||"center";h.fillStyle=U||"#fff";h.font=(R||50)+"px Impact, Charcoal";h.strokeStyle="#000";h.strokeText(J,l,F);h.fillText(J,l,F)};Y=X=B=A=z=v=u=0;a=new XMLHttpRequest;a.open("GET",1);a.responseType="arraybuffer";a.send();
a.onload=function(){b=new Uint8Array(a.response);c=0;for(i in g)for(j in g[i]=g[i].split(1),g[i])for(k in g[i][j]=g[i][j].split(/(?=[A-Z])/),g[i][j])if(3>i)g[i][j][k]=[g[i][j][k],[b[c],b[c+1]]],c+=2;else{for(g[i][j][k]=[g[i][j][k],[]];254!=b[c]&&c<b.length;)g[i][j][k][1].push(b[c]),c++;c++}g[3][0][0][1]=[105,81,107,78,113,76,112,82,114,88,114,97,116,102,111,109,109,110,100,95,99,93,106,85,255,109,78];g[2][0][6][1]=[207,218];g[1][1][7][1]=[121,137];w()};
w=function(){$.width^=0;if(0==n){h.fillRect(0,0,1200,650);u--;u%=1200;for(i=0;300>i;i++)h.fillStyle="#fff",h.beginPath(),h.arc(a=s[i][0]+u,b=s[i][1],c=s[i][2]+.2*m.random(),0,7),h.arc(1200+a,b,c,0,7),h.fill();h.beginPath();gradient=h.createLinearGradient(300,0,600,0);gradient.addColorStop(0,"#75D1FF");gradient.addColorStop(1,"#3591bF");h.fillStyle=gradient;h.arc(470,260,140,0,7);h.fill();v++;v%=220;h.strokeStyle="#83864F";h.fillStyle="#95D866";for(i=4;i--;)for(j=0;j<g[3][i].length;j++){a=3==i&&3==
j?[]:g[3][i][j][1];for(k=0;k<a.length;k+=2){255==a[k]&&(k++,h.closePath(),h.fill(),h.stroke(),h.beginPath());255==a[k+1]&&(k+=2,h.closePath(),h.fill(),h.stroke(),h.beginPath());x=(a[k]-v+100)/110;for(y=(a[k+1]-120)/150;1<x;)x-=2;-1<x&&-.5>x&&(x=-.5);.5<x&&1>x&&(x=.5);k||"Russia"==g[3][i][j][0]||"Canada"==g[3][i][j][0]||(b=0>x?-.5:.5);"Russia"==g[3][i][j][0]&&(b=.5,50<v&&(b=-.5),160<v&&(b=.5));"Canada"==g[3][i][j][0]&&(b=.5,160<v&&(b=-.5),50>v&&(b=-.5));if(-.5>=x||.5<=x)x=b;x=m.sin(x*m.PI)*m.cos(y*
m.PI/2);y=m.sin(y*m.PI/2);x=140*x+470;y=140*y+260;0==k&&(h.beginPath(),h.moveTo(x,y));h.lineTo(x,y)}h.closePath();h.fill();h.stroke()}t(180,375,"GE",300);t(890,375,"Quiz",300);t(990,405,"JS13kGames 2015",30);t(600,570,"START",80)}else if(1==n)h.fillRect(0,0,1200,650),t(600,280,"Level "+(A+1)+":",60),t(600,360,"Countries (easy);Capitols (easy);Famous places (easy);Countries (medium);Capitols (medium);U.S. states (medium);Famous places (medium);U.S. capitols (medium);World countries (hard);U.S. states (hard);Famous places (hard);U.S. capitols (hard);Capitols (hard)".split(";")[A],
60),t(600,450,"START",30);else if(2==n||3==n){C=[g[3][0],g[1][0],g[0][0],g[3][1],g[1][1],g[4][0],g[0][1],g[2][0],g[3][2],g[4][1],g[0][2],g[2][1],g[1][2]][A];f=5==A||7==A||9==A||11==A?4:3;for(i=g[f].length;i--;)for(j=0;j<g[f][i].length;j++){a=g[f][i][j][1];for(k=0;k<a.length;k+=2){255==a[k]&&(k++,h.closePath(),h.fill(),h.stroke(),h.beginPath());255==a[k+1]&&(k+=2,h.closePath(),h.fill(),h.stroke(),h.beginPath());x=a[k]*(4==f?4.8:4.9);y=a[k+1]*(4==f?2.46:2.35)+(4==f?38:65);if(4==B||9==B)x=1200-x,y=715-
y;0==k&&(h.beginPath(),h.strokeStyle=5>B?"#83864F":"#000",h.fillStyle=5>B?"#95D866":"#000","#95D866",h.moveTo(x,y));h.lineTo(x,y)}h.closePath();h.fill();h.stroke()}2==n&&0==o&&(n=3,o=60,z=1);if(3==n){a=C[B][1];if(0==A||3==A||5==A||8==A||9==A){h.fillStyle="yellow";h.beginPath();for(k=0;k<a.length;k+=2){255==a[k]&&(k++,h.closePath(),h.fill(),h.stroke(),60==o&&h.isPointInPath(X,Y)&&(p=0,c=[X,Y]),h.beginPath());255==a[k+1]&&(k+=2,h.closePath(),h.fill(),h.stroke(),60==o&&h.isPointInPath(X,Y)&&(p=0,c=[X,
Y]),h.beginPath());x=a[k]*(4==f?4.8:4.9);y=a[k+1]*(4==f?2.46:2.35)+(4==f?38:65);if(4==B||9==B)x=1200-x,y=715-y;60==o&&(b=m.sqrt(m.pow(x-X,2)+m.pow(y-Y,2)),b<p&&(p=b,c=[x,y]));0==k&&(h.beginPath(),h.moveTo(x,y));h.lineTo(x,y)}h.closePath();h.fill();h.stroke();60==o&&h.isPointInPath(X,Y)&&(p=0,c=[X,Y])}else{x=a[0]*(4==f?4.8:4.9);y=a[1]*(4==f?2.46:2.35)+(4==f?38:65);if(4==B||9==B)x=1200-x,y=715-y;h.fillStyle="yellow";h.beginPath();h.arc(x,y,10,0,7);h.fill();60==o&&(p=b=m.sqrt(m.pow(x-X,2)+m.pow(y-Y,
2)),c=[x,y])}z||(5<p&&(h.fillStyle="green",h.strokeStyle="green",h.beginPath(),h.moveTo(c[0],c[1]),h.lineTo(c[0]-1,c[1]),h.lineTo(c[0]-1,c[1]-40),h.lineTo(c[0],c[1]-40),h.lineTo(c[0]+20,c[1]-30),h.lineTo(c[0],c[1]-20),h.stroke(),h.fill(),h.strokeStyle="red",h.lineWidth="2",h.setLineDash([5,5]),h.beginPath(),h.moveTo(X,Y),h.lineTo(c[0],c[1]),h.stroke()),h.setLineDash([0,0]),h.fillStyle="blue",h.strokeStyle="blue",h.beginPath(),h.moveTo(X,Y),h.lineTo(X-1,Y),h.lineTo(X-1,Y-40),h.lineTo(X,Y-40),h.lineTo(X+
20,Y-30),h.lineTo(X,Y-20),h.stroke(),h.fill());45==o&&(5==A||7==A||9==A||11==A?(e=100>p?100*~~(p/10):1E3*~~(p/100),q-=z?5E3:e):(e=100>p?100*~~(p/4):1E3*~~(p/40),q-=z?1E4:e));45>o&&(z?(t(600,350,"TIME OUT",100,5>B?"#000":"#fff"),5==A||7==A||9==A||11==A?t(600,400,"5,000km penalty",50,5>B?"#000":"#fff"):t(600,400,"10,000km penalty",50,5>B?"#000":"#fff")):t(600,350,5<p?e+"km away":"PERFECT",100,5>B?"#000":"#fff"));d=0;0>=q&&(q=0,d=1);0==o&&(n=4,o=15)}h.beginPath();h.fillStyle="#000";h.rect(0,0,1200,66);
h.fill();h.closePath();h.beginPath();h.fillStyle="#fff";2==n&&(h.rect(0,60,4*o,5),h.fill());h.closePath();t(10,45,"Country;Capitol;Place;Country;Capitol;U.S. state;Place;U.S. capitol;Country;U.S. state;Place;U.S. capitol;Capitol".split(";")[A]+": "+C[B][0].toUpperCase(),40,0,"left");t(1190,45,q+"km remaining",40,0,"right")}if(4==n&&(d&&(n=5),h.fillRect(0,0,1200,650),0==o)){Y=X=0;B++;n=2;p=5E4;o=300;z=0;if(9<B){B=0;A++;n=1;r+=q;q=3E4;if(5==A||7==A||9==A||11==A)q=15E3;12<A&&(n=5);M.t*=1.075}M.r=4==
B||9==B?!0:!1;4<=B&&9>=B?(M.f=0,M.a=[60,10],M.b=1.5,M.c=.6):(M.f=.1,M.a=[22,8,9,3,2,1],M.b=1.5,M.c=.1)}5==n&&(h.fillRect(0,0,1200,650),t(600,280,13==A?"YOU WON!":"GAME OVER!"),t(600,360,"Level "+(A+1)+" ~ total score: "+r+"km",40),t(600,450,"REPLAY?",30),Z.style.display="block");o&&o--;setTimeout(w,33)};
$.onclick=function(l){0==n?(n=1,b=function(){return.5-m.random()},g[0][0].sort(b),g[0][1].sort(b),g[0][2].sort(b),g[1][0].sort(b),g[1][1].sort(b),g[1][2].sort(b),g[2][0].sort(b),g[2][1].sort(b),g[3][0].sort(b),g[3][1].sort(b),g[3][2].sort(b),g[4][0].sort(b),g[4][1].sort(b)):1==n?(n=2,o=300):2==n?(X=l.pageX,Y=l.pageY,n=3,o=60):5==n&&(window.location=window.location)};
M=new function(){if(window.AudioContext){var l=this,F=new AudioContext,J=F.createScriptProcessor(4096,0,1),R=F.sampleRate/48E3,U=Math.floor,G=Math.pow,N=Math.sin,O=Math.random,V=2*Math.PI,P=function(l){var D=0;return function(E){D+=G(2,E/12)*R;D>V&&(D-=V);return l(D)}},ba=[[0,1,4,5,7,10,12],[-2,0,1,4,5,8,1],[5,3,0,9,0],[0,4,7,1,-2],[1,3,5,7,8,10,12],[5,3,12,0,13]],ca=[.9,.4,.7,.3,.2,.9,.3],da=[-84,-86,-79,-84,-83,-79],fa=P(function(l){return N(l)+.6*O()}),ga=P(N),ha=P(function(G){for(var D=0,E=0;E<
l.a.length;E++)D+=N(G*(E+1))*l.a[E];return D}),ia=P(function(l){return l/V-.5+3*G(N(l),5)}),Q=1,I=-1,W=0,L=16777215,ea=!0,T=0;J.onaudioprocess=function(F){F=F.outputBuffer.getChannelData(0);for(var D=0;D<F.length;D++){Q+=l.t/R;T+=.001/R;if(1<=Q){--Q;I++;var E=ca[I%ca.length];if(ea=O()<E).1>O()&&(L-=2),.2>O()&&(L+=4),.6>O()&&(L+=l.r?-1:1)}W=U(I/32);var E=1-Q,K=(Q+(I&1))/2,J=1-K,H=0;if(ea)var S=ba[W%ba.length],H=H+ha(l.x-60+S[L%S.length]+N(1.3*T)*l.h)*(l.r?K:E)*(I&1?.04:.1)*l.p;var S=I&3,P=da[W%da.length];
2!=S&&(H+=ia(l.x+P+(3==S?12:0)+N(T)*l.c)*E*l.b*(I&1?.03:.12));K=l.r?K:J;H+=ga(-95+40*G(K,5))*l.k*G(K,5);I&2&&(H+=fa(-80+60*G(K,15))*l.f*G(K,5));H+=O()*G(E,10)*(I&1?.03:.1)*l.g;F[D]=H}};J.connect(F.destination);l.stop=function(){J.disconnect()};l.r=!1;l.k=.12;l.g=.9;l.f=.1;l.p=.06;l.b=1.5;l.t=9.3E-5;l.a=[22,8,9,3,2,1];l.h=.2;l.c=.1;l.x=1}}</script><title>GeoQuiz