[{"data":1,"prerenderedAt":1998},["ShallowReactive",2],{"post-2019-02-28-google-hash-code-2019":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"published":10,"summary":9,"draft":6,"image":11,"categories":12,"tags":15,"showAuthor":6,"authors":17,"showAuthorsBadges":6,"body":19,"_type":1992,"_id":1993,"_source":1994,"_file":1995,"_stem":1996,"_extension":1997},"/posts/2019-02-28-google-hash-code-2019","posts",false,"","Google Hash Code 2019","This years challenge was based on images and producing the most interesting slideshow, essentially we would be given files with theoretical images (horizontal and vertical) and we would have to pair slides based on the tags that the photos contained.","2019-02-28T23:00:00-00:00","/2019-02-28-google-hash-code-2019.png",[13,14],"Technology","Hackathon",[16],"Data",[18],"sean",{"type":20,"children":21,"toc":1985},"root",[22,29,34,44,49,57,62,69,74,87,405,412,417,628,641,825,861,866,1099,1105,1110,1487,1492,1835,1840,1848,1853,1883,1889,1895,1900,1905,1913,1926,1947,1950,1955,1979],{"type":23,"tag":24,"props":25,"children":26},"element","p",{},[27],{"type":28,"value":9},"text",{"type":23,"tag":24,"props":30,"children":31},{},[32],{"type":28,"value":33},"Example Input (4 referring to the amount of photos and 3/2 to the number of tags in that photo):",{"type":23,"tag":35,"props":36,"children":38},"pre",{"code":37},"4\nH 3 cat beach sun\nV 2 selfie smile\nV 2 garden selfie\nH 2 garden cat\n",[39],{"type":23,"tag":40,"props":41,"children":42},"code",{"__ignoreMap":7},[43],{"type":28,"value":37},{"type":23,"tag":24,"props":45,"children":46},{},[47],{"type":28,"value":48},"On a slide (giving the index of the photo wanted) could be either one horizontal photo, or two vertical ones, the tags being the ones in both photos for the two vertical photos case.",{"type":23,"tag":35,"props":50,"children":52},{"code":51},"3\n1 2\n3\n0\n",[53],{"type":23,"tag":40,"props":54,"children":55},{"__ignoreMap":7},[56],{"type":28,"value":51},{"type":23,"tag":24,"props":58,"children":59},{},[60],{"type":28,"value":61},"The interest score would then be decided by the minimum of three criteria, those being the tags ONLY in the first slide, the tags SHARED amongst the two slides, then the tags ONLY in the second slide. With the interest score between every two slides being summed up you would then have the amount of points for that slideshow.",{"type":23,"tag":63,"props":64,"children":66},"h2",{"id":65},"problem-solving",[67],{"type":28,"value":68},"Problem Solving",{"type":23,"tag":24,"props":70,"children":71},{},[72],{"type":28,"value":73},"I did take part in Google Hash Code last year and my team got a score of zero since we spent too much time trying to code an elegant solution in Java, so to ensure we did not get 0 I came up with an idea and code to produce a valid output and try to optimise it slightly.",{"type":23,"tag":24,"props":75,"children":76},{},[77,79,85],{"type":28,"value":78},"I choice NodeJS to code in, since I am very familiar with it and could easily produce a solution to fit the problem space, having only to use ",{"type":23,"tag":40,"props":80,"children":82},{"className":81},[],[83],{"type":28,"value":84},"let fs = require('fs')",{"type":28,"value":86}," to quickly prove I could get the data in and sanitize it quickly (below being what I wrote to do so).",{"type":23,"tag":35,"props":88,"children":92},{"code":89,"language":90,"meta":7,"className":91,"style":7},"let obj = fs.readFileSync(`${fileName}.txt`, 'utf8').toString();\n    photos = obj.split(\"\\n\").map(v => v.split(' '));\n    photos = photos.slice(1, photos.length);\n    photos = photos.map((v, i) => {\n        v.i = i;\n        return v;\n    });\n","javascript","language-javascript shiki shiki-themes github-dark",[93],{"type":23,"tag":40,"props":94,"children":95},{"__ignoreMap":7},[96,176,265,311,364,382,396],{"type":23,"tag":97,"props":98,"children":101},"span",{"class":99,"line":100},"line",1,[102,108,114,119,124,130,135,141,146,151,156,161,166,171],{"type":23,"tag":97,"props":103,"children":105},{"style":104},"--shiki-default:#F97583",[106],{"type":28,"value":107},"let",{"type":23,"tag":97,"props":109,"children":111},{"style":110},"--shiki-default:#E1E4E8",[112],{"type":28,"value":113}," obj ",{"type":23,"tag":97,"props":115,"children":116},{"style":104},[117],{"type":28,"value":118},"=",{"type":23,"tag":97,"props":120,"children":121},{"style":110},[122],{"type":28,"value":123}," fs.",{"type":23,"tag":97,"props":125,"children":127},{"style":126},"--shiki-default:#B392F0",[128],{"type":28,"value":129},"readFileSync",{"type":23,"tag":97,"props":131,"children":132},{"style":110},[133],{"type":28,"value":134},"(",{"type":23,"tag":97,"props":136,"children":138},{"style":137},"--shiki-default:#9ECBFF",[139],{"type":28,"value":140},"`${",{"type":23,"tag":97,"props":142,"children":143},{"style":110},[144],{"type":28,"value":145},"fileName",{"type":23,"tag":97,"props":147,"children":148},{"style":137},[149],{"type":28,"value":150},"}.txt`",{"type":23,"tag":97,"props":152,"children":153},{"style":110},[154],{"type":28,"value":155},", ",{"type":23,"tag":97,"props":157,"children":158},{"style":137},[159],{"type":28,"value":160},"'utf8'",{"type":23,"tag":97,"props":162,"children":163},{"style":110},[164],{"type":28,"value":165},").",{"type":23,"tag":97,"props":167,"children":168},{"style":126},[169],{"type":28,"value":170},"toString",{"type":23,"tag":97,"props":172,"children":173},{"style":110},[174],{"type":28,"value":175},"();\n",{"type":23,"tag":97,"props":177,"children":179},{"class":99,"line":178},2,[180,185,189,194,199,203,208,214,218,222,227,231,237,242,247,251,255,260],{"type":23,"tag":97,"props":181,"children":182},{"style":110},[183],{"type":28,"value":184},"    photos ",{"type":23,"tag":97,"props":186,"children":187},{"style":104},[188],{"type":28,"value":118},{"type":23,"tag":97,"props":190,"children":191},{"style":110},[192],{"type":28,"value":193}," obj.",{"type":23,"tag":97,"props":195,"children":196},{"style":126},[197],{"type":28,"value":198},"split",{"type":23,"tag":97,"props":200,"children":201},{"style":110},[202],{"type":28,"value":134},{"type":23,"tag":97,"props":204,"children":205},{"style":137},[206],{"type":28,"value":207},"\"",{"type":23,"tag":97,"props":209,"children":211},{"style":210},"--shiki-default:#79B8FF",[212],{"type":28,"value":213},"\\n",{"type":23,"tag":97,"props":215,"children":216},{"style":137},[217],{"type":28,"value":207},{"type":23,"tag":97,"props":219,"children":220},{"style":110},[221],{"type":28,"value":165},{"type":23,"tag":97,"props":223,"children":224},{"style":126},[225],{"type":28,"value":226},"map",{"type":23,"tag":97,"props":228,"children":229},{"style":110},[230],{"type":28,"value":134},{"type":23,"tag":97,"props":232,"children":234},{"style":233},"--shiki-default:#FFAB70",[235],{"type":28,"value":236},"v",{"type":23,"tag":97,"props":238,"children":239},{"style":104},[240],{"type":28,"value":241}," =>",{"type":23,"tag":97,"props":243,"children":244},{"style":110},[245],{"type":28,"value":246}," v.",{"type":23,"tag":97,"props":248,"children":249},{"style":126},[250],{"type":28,"value":198},{"type":23,"tag":97,"props":252,"children":253},{"style":110},[254],{"type":28,"value":134},{"type":23,"tag":97,"props":256,"children":257},{"style":137},[258],{"type":28,"value":259},"' '",{"type":23,"tag":97,"props":261,"children":262},{"style":110},[263],{"type":28,"value":264},"));\n",{"type":23,"tag":97,"props":266,"children":268},{"class":99,"line":267},3,[269,273,277,282,287,291,296,301,306],{"type":23,"tag":97,"props":270,"children":271},{"style":110},[272],{"type":28,"value":184},{"type":23,"tag":97,"props":274,"children":275},{"style":104},[276],{"type":28,"value":118},{"type":23,"tag":97,"props":278,"children":279},{"style":110},[280],{"type":28,"value":281}," photos.",{"type":23,"tag":97,"props":283,"children":284},{"style":126},[285],{"type":28,"value":286},"slice",{"type":23,"tag":97,"props":288,"children":289},{"style":110},[290],{"type":28,"value":134},{"type":23,"tag":97,"props":292,"children":293},{"style":210},[294],{"type":28,"value":295},"1",{"type":23,"tag":97,"props":297,"children":298},{"style":110},[299],{"type":28,"value":300},", photos.",{"type":23,"tag":97,"props":302,"children":303},{"style":210},[304],{"type":28,"value":305},"length",{"type":23,"tag":97,"props":307,"children":308},{"style":110},[309],{"type":28,"value":310},");\n",{"type":23,"tag":97,"props":312,"children":314},{"class":99,"line":313},4,[315,319,323,327,331,336,340,344,349,354,359],{"type":23,"tag":97,"props":316,"children":317},{"style":110},[318],{"type":28,"value":184},{"type":23,"tag":97,"props":320,"children":321},{"style":104},[322],{"type":28,"value":118},{"type":23,"tag":97,"props":324,"children":325},{"style":110},[326],{"type":28,"value":281},{"type":23,"tag":97,"props":328,"children":329},{"style":126},[330],{"type":28,"value":226},{"type":23,"tag":97,"props":332,"children":333},{"style":110},[334],{"type":28,"value":335},"((",{"type":23,"tag":97,"props":337,"children":338},{"style":233},[339],{"type":28,"value":236},{"type":23,"tag":97,"props":341,"children":342},{"style":110},[343],{"type":28,"value":155},{"type":23,"tag":97,"props":345,"children":346},{"style":233},[347],{"type":28,"value":348},"i",{"type":23,"tag":97,"props":350,"children":351},{"style":110},[352],{"type":28,"value":353},") ",{"type":23,"tag":97,"props":355,"children":356},{"style":104},[357],{"type":28,"value":358},"=>",{"type":23,"tag":97,"props":360,"children":361},{"style":110},[362],{"type":28,"value":363}," {\n",{"type":23,"tag":97,"props":365,"children":367},{"class":99,"line":366},5,[368,373,377],{"type":23,"tag":97,"props":369,"children":370},{"style":110},[371],{"type":28,"value":372},"        v.i ",{"type":23,"tag":97,"props":374,"children":375},{"style":104},[376],{"type":28,"value":118},{"type":23,"tag":97,"props":378,"children":379},{"style":110},[380],{"type":28,"value":381}," i;\n",{"type":23,"tag":97,"props":383,"children":385},{"class":99,"line":384},6,[386,391],{"type":23,"tag":97,"props":387,"children":388},{"style":104},[389],{"type":28,"value":390},"        return",{"type":23,"tag":97,"props":392,"children":393},{"style":110},[394],{"type":28,"value":395}," v;\n",{"type":23,"tag":97,"props":397,"children":399},{"class":99,"line":398},7,[400],{"type":23,"tag":97,"props":401,"children":402},{"style":110},[403],{"type":28,"value":404},"    });\n",{"type":23,"tag":406,"props":407,"children":409},"h3",{"id":408},"evaluating-slideshows",[410],{"type":28,"value":411},"Evaluating Slideshows",{"type":23,"tag":24,"props":413,"children":414},{},[415],{"type":28,"value":416},"With confidence I decided to code the method they described they'd mark the output, choosing to go bottom up and produce a function which could take in a array of indexes and give me bag the tags for them.",{"type":23,"tag":35,"props":418,"children":420},{"code":419,"language":90,"meta":7,"className":91,"style":7},"function getTags(indexes) {\n    let tags = [];\n    indexes.forEach(i => {\n        photos[i].forEach((v, i) => {\n            if (i >= 2) tags.push(v);\n        });\n    });\n    return tags.filter(onlyUnique);\n}\n",[421],{"type":23,"tag":40,"props":422,"children":423},{"__ignoreMap":7},[424,451,473,502,542,580,588,595,619],{"type":23,"tag":97,"props":425,"children":426},{"class":99,"line":100},[427,432,437,441,446],{"type":23,"tag":97,"props":428,"children":429},{"style":104},[430],{"type":28,"value":431},"function",{"type":23,"tag":97,"props":433,"children":434},{"style":126},[435],{"type":28,"value":436}," getTags",{"type":23,"tag":97,"props":438,"children":439},{"style":110},[440],{"type":28,"value":134},{"type":23,"tag":97,"props":442,"children":443},{"style":233},[444],{"type":28,"value":445},"indexes",{"type":23,"tag":97,"props":447,"children":448},{"style":110},[449],{"type":28,"value":450},") {\n",{"type":23,"tag":97,"props":452,"children":453},{"class":99,"line":178},[454,459,464,468],{"type":23,"tag":97,"props":455,"children":456},{"style":104},[457],{"type":28,"value":458},"    let",{"type":23,"tag":97,"props":460,"children":461},{"style":110},[462],{"type":28,"value":463}," tags ",{"type":23,"tag":97,"props":465,"children":466},{"style":104},[467],{"type":28,"value":118},{"type":23,"tag":97,"props":469,"children":470},{"style":110},[471],{"type":28,"value":472}," [];\n",{"type":23,"tag":97,"props":474,"children":475},{"class":99,"line":267},[476,481,486,490,494,498],{"type":23,"tag":97,"props":477,"children":478},{"style":110},[479],{"type":28,"value":480},"    indexes.",{"type":23,"tag":97,"props":482,"children":483},{"style":126},[484],{"type":28,"value":485},"forEach",{"type":23,"tag":97,"props":487,"children":488},{"style":110},[489],{"type":28,"value":134},{"type":23,"tag":97,"props":491,"children":492},{"style":233},[493],{"type":28,"value":348},{"type":23,"tag":97,"props":495,"children":496},{"style":104},[497],{"type":28,"value":241},{"type":23,"tag":97,"props":499,"children":500},{"style":110},[501],{"type":28,"value":363},{"type":23,"tag":97,"props":503,"children":504},{"class":99,"line":313},[505,510,514,518,522,526,530,534,538],{"type":23,"tag":97,"props":506,"children":507},{"style":110},[508],{"type":28,"value":509},"        photos[i].",{"type":23,"tag":97,"props":511,"children":512},{"style":126},[513],{"type":28,"value":485},{"type":23,"tag":97,"props":515,"children":516},{"style":110},[517],{"type":28,"value":335},{"type":23,"tag":97,"props":519,"children":520},{"style":233},[521],{"type":28,"value":236},{"type":23,"tag":97,"props":523,"children":524},{"style":110},[525],{"type":28,"value":155},{"type":23,"tag":97,"props":527,"children":528},{"style":233},[529],{"type":28,"value":348},{"type":23,"tag":97,"props":531,"children":532},{"style":110},[533],{"type":28,"value":353},{"type":23,"tag":97,"props":535,"children":536},{"style":104},[537],{"type":28,"value":358},{"type":23,"tag":97,"props":539,"children":540},{"style":110},[541],{"type":28,"value":363},{"type":23,"tag":97,"props":543,"children":544},{"class":99,"line":366},[545,550,555,560,565,570,575],{"type":23,"tag":97,"props":546,"children":547},{"style":104},[548],{"type":28,"value":549},"            if",{"type":23,"tag":97,"props":551,"children":552},{"style":110},[553],{"type":28,"value":554}," (i ",{"type":23,"tag":97,"props":556,"children":557},{"style":104},[558],{"type":28,"value":559},">=",{"type":23,"tag":97,"props":561,"children":562},{"style":210},[563],{"type":28,"value":564}," 2",{"type":23,"tag":97,"props":566,"children":567},{"style":110},[568],{"type":28,"value":569},") tags.",{"type":23,"tag":97,"props":571,"children":572},{"style":126},[573],{"type":28,"value":574},"push",{"type":23,"tag":97,"props":576,"children":577},{"style":110},[578],{"type":28,"value":579},"(v);\n",{"type":23,"tag":97,"props":581,"children":582},{"class":99,"line":384},[583],{"type":23,"tag":97,"props":584,"children":585},{"style":110},[586],{"type":28,"value":587},"        });\n",{"type":23,"tag":97,"props":589,"children":590},{"class":99,"line":398},[591],{"type":23,"tag":97,"props":592,"children":593},{"style":110},[594],{"type":28,"value":404},{"type":23,"tag":97,"props":596,"children":598},{"class":99,"line":597},8,[599,604,609,614],{"type":23,"tag":97,"props":600,"children":601},{"style":104},[602],{"type":28,"value":603},"    return",{"type":23,"tag":97,"props":605,"children":606},{"style":110},[607],{"type":28,"value":608}," tags.",{"type":23,"tag":97,"props":610,"children":611},{"style":126},[612],{"type":28,"value":613},"filter",{"type":23,"tag":97,"props":615,"children":616},{"style":110},[617],{"type":28,"value":618},"(onlyUnique);\n",{"type":23,"tag":97,"props":620,"children":622},{"class":99,"line":621},9,[623],{"type":23,"tag":97,"props":624,"children":625},{"style":110},[626],{"type":28,"value":627},"}\n",{"type":23,"tag":24,"props":629,"children":630},{},[631,633,639],{"type":28,"value":632},"After testing this function with console logs on various examples (",{"type":23,"tag":40,"props":634,"children":636},{"className":635},[],[637],{"type":28,"value":638},"console.log(getTags([1, 2]))",{"type":28,"value":640},") and verifying the output, I could then write a compare function for two slides that would be able to use the tags of photos given.",{"type":23,"tag":35,"props":642,"children":644},{"code":643,"language":90,"meta":7,"className":91,"style":7},"function compare(a, b) {\n    let a_tags = getTags(a),\n        b_tags = getTags(b);\n    let a_tot = onlyIn(a_tags, b_tags),\n        union = unionCount(a_tags, b_tags),\n        b_tot = onlyIn(b_tags, a_tags);\n    return Math.min(a_tot, union, b_tot);\n}\n",[645],{"type":23,"tag":40,"props":646,"children":647},{"__ignoreMap":7},[648,682,707,728,754,775,796,818],{"type":23,"tag":97,"props":649,"children":650},{"class":99,"line":100},[651,655,660,664,669,673,678],{"type":23,"tag":97,"props":652,"children":653},{"style":104},[654],{"type":28,"value":431},{"type":23,"tag":97,"props":656,"children":657},{"style":126},[658],{"type":28,"value":659}," compare",{"type":23,"tag":97,"props":661,"children":662},{"style":110},[663],{"type":28,"value":134},{"type":23,"tag":97,"props":665,"children":666},{"style":233},[667],{"type":28,"value":668},"a",{"type":23,"tag":97,"props":670,"children":671},{"style":110},[672],{"type":28,"value":155},{"type":23,"tag":97,"props":674,"children":675},{"style":233},[676],{"type":28,"value":677},"b",{"type":23,"tag":97,"props":679,"children":680},{"style":110},[681],{"type":28,"value":450},{"type":23,"tag":97,"props":683,"children":684},{"class":99,"line":178},[685,689,694,698,702],{"type":23,"tag":97,"props":686,"children":687},{"style":104},[688],{"type":28,"value":458},{"type":23,"tag":97,"props":690,"children":691},{"style":110},[692],{"type":28,"value":693}," a_tags ",{"type":23,"tag":97,"props":695,"children":696},{"style":104},[697],{"type":28,"value":118},{"type":23,"tag":97,"props":699,"children":700},{"style":126},[701],{"type":28,"value":436},{"type":23,"tag":97,"props":703,"children":704},{"style":110},[705],{"type":28,"value":706},"(a),\n",{"type":23,"tag":97,"props":708,"children":709},{"class":99,"line":267},[710,715,719,723],{"type":23,"tag":97,"props":711,"children":712},{"style":110},[713],{"type":28,"value":714},"        b_tags ",{"type":23,"tag":97,"props":716,"children":717},{"style":104},[718],{"type":28,"value":118},{"type":23,"tag":97,"props":720,"children":721},{"style":126},[722],{"type":28,"value":436},{"type":23,"tag":97,"props":724,"children":725},{"style":110},[726],{"type":28,"value":727},"(b);\n",{"type":23,"tag":97,"props":729,"children":730},{"class":99,"line":313},[731,735,740,744,749],{"type":23,"tag":97,"props":732,"children":733},{"style":104},[734],{"type":28,"value":458},{"type":23,"tag":97,"props":736,"children":737},{"style":110},[738],{"type":28,"value":739}," a_tot ",{"type":23,"tag":97,"props":741,"children":742},{"style":104},[743],{"type":28,"value":118},{"type":23,"tag":97,"props":745,"children":746},{"style":126},[747],{"type":28,"value":748}," onlyIn",{"type":23,"tag":97,"props":750,"children":751},{"style":110},[752],{"type":28,"value":753},"(a_tags, b_tags),\n",{"type":23,"tag":97,"props":755,"children":756},{"class":99,"line":366},[757,762,766,771],{"type":23,"tag":97,"props":758,"children":759},{"style":110},[760],{"type":28,"value":761},"        union ",{"type":23,"tag":97,"props":763,"children":764},{"style":104},[765],{"type":28,"value":118},{"type":23,"tag":97,"props":767,"children":768},{"style":126},[769],{"type":28,"value":770}," unionCount",{"type":23,"tag":97,"props":772,"children":773},{"style":110},[774],{"type":28,"value":753},{"type":23,"tag":97,"props":776,"children":777},{"class":99,"line":384},[778,783,787,791],{"type":23,"tag":97,"props":779,"children":780},{"style":110},[781],{"type":28,"value":782},"        b_tot ",{"type":23,"tag":97,"props":784,"children":785},{"style":104},[786],{"type":28,"value":118},{"type":23,"tag":97,"props":788,"children":789},{"style":126},[790],{"type":28,"value":748},{"type":23,"tag":97,"props":792,"children":793},{"style":110},[794],{"type":28,"value":795},"(b_tags, a_tags);\n",{"type":23,"tag":97,"props":797,"children":798},{"class":99,"line":398},[799,803,808,813],{"type":23,"tag":97,"props":800,"children":801},{"style":104},[802],{"type":28,"value":603},{"type":23,"tag":97,"props":804,"children":805},{"style":110},[806],{"type":28,"value":807}," Math.",{"type":23,"tag":97,"props":809,"children":810},{"style":126},[811],{"type":28,"value":812},"min",{"type":23,"tag":97,"props":814,"children":815},{"style":110},[816],{"type":28,"value":817},"(a_tot, union, b_tot);\n",{"type":23,"tag":97,"props":819,"children":820},{"class":99,"line":597},[821],{"type":23,"tag":97,"props":822,"children":823},{"style":110},[824],{"type":28,"value":627},{"type":23,"tag":24,"props":826,"children":827},{},[828,830,836,838,844,846,851,853,859],{"type":28,"value":829},"Similarly I tested this out with console logging (",{"type":23,"tag":40,"props":831,"children":833},{"className":832},[],[834],{"type":28,"value":835},"console.log(compare([1, 2], [3]))",{"type":28,"value":837},") but also writing a log within the function itself to verify the values (",{"type":23,"tag":40,"props":839,"children":841},{"className":840},[],[842],{"type":28,"value":843},"console.log(a: ${a_tot} union: ${union} b: ${b_tot})",{"type":28,"value":845},"), which highlighted that initially within the onlyIn functions I was incorrectly passing ",{"type":23,"tag":40,"props":847,"children":849},{"className":848},[],[850],{"type":28,"value":668},{"type":28,"value":852}," and not ",{"type":23,"tag":40,"props":854,"children":856},{"className":855},[],[857],{"type":28,"value":858},"a_tags",{"type":28,"value":860},".",{"type":23,"tag":24,"props":862,"children":863},{},[864],{"type":28,"value":865},"From there and around an hour in, I could then write the evaluation function needed to iterate over my potential slideshows, this was relatively easy since using an ES6 function and ensuring I don't go Out of Bounds (our team name).",{"type":23,"tag":35,"props":867,"children":869},{"code":868,"language":90,"meta":7,"className":91,"style":7},"function eval(slideshow) {\n    return slideshow.reduce((sum, val, i, arr) => {\n        let t = (i != arr.length - 1) ? compare(val, arr[i + 1]) : 0;\n        return sum + t;\n    }, 0);\n}\n",[870],{"type":23,"tag":40,"props":871,"children":872},{"__ignoreMap":7},[873,898,962,1054,1075,1092],{"type":23,"tag":97,"props":874,"children":875},{"class":99,"line":100},[876,880,885,889,894],{"type":23,"tag":97,"props":877,"children":878},{"style":104},[879],{"type":28,"value":431},{"type":23,"tag":97,"props":881,"children":882},{"style":126},[883],{"type":28,"value":884}," eval",{"type":23,"tag":97,"props":886,"children":887},{"style":110},[888],{"type":28,"value":134},{"type":23,"tag":97,"props":890,"children":891},{"style":233},[892],{"type":28,"value":893},"slideshow",{"type":23,"tag":97,"props":895,"children":896},{"style":110},[897],{"type":28,"value":450},{"type":23,"tag":97,"props":899,"children":900},{"class":99,"line":178},[901,905,910,915,919,924,928,933,937,941,945,950,954,958],{"type":23,"tag":97,"props":902,"children":903},{"style":104},[904],{"type":28,"value":603},{"type":23,"tag":97,"props":906,"children":907},{"style":110},[908],{"type":28,"value":909}," slideshow.",{"type":23,"tag":97,"props":911,"children":912},{"style":126},[913],{"type":28,"value":914},"reduce",{"type":23,"tag":97,"props":916,"children":917},{"style":110},[918],{"type":28,"value":335},{"type":23,"tag":97,"props":920,"children":921},{"style":233},[922],{"type":28,"value":923},"sum",{"type":23,"tag":97,"props":925,"children":926},{"style":110},[927],{"type":28,"value":155},{"type":23,"tag":97,"props":929,"children":930},{"style":233},[931],{"type":28,"value":932},"val",{"type":23,"tag":97,"props":934,"children":935},{"style":110},[936],{"type":28,"value":155},{"type":23,"tag":97,"props":938,"children":939},{"style":233},[940],{"type":28,"value":348},{"type":23,"tag":97,"props":942,"children":943},{"style":110},[944],{"type":28,"value":155},{"type":23,"tag":97,"props":946,"children":947},{"style":233},[948],{"type":28,"value":949},"arr",{"type":23,"tag":97,"props":951,"children":952},{"style":110},[953],{"type":28,"value":353},{"type":23,"tag":97,"props":955,"children":956},{"style":104},[957],{"type":28,"value":358},{"type":23,"tag":97,"props":959,"children":960},{"style":110},[961],{"type":28,"value":363},{"type":23,"tag":97,"props":963,"children":964},{"class":99,"line":267},[965,970,975,979,983,988,993,997,1002,1007,1011,1016,1020,1025,1030,1034,1039,1044,1049],{"type":23,"tag":97,"props":966,"children":967},{"style":104},[968],{"type":28,"value":969},"        let",{"type":23,"tag":97,"props":971,"children":972},{"style":110},[973],{"type":28,"value":974}," t ",{"type":23,"tag":97,"props":976,"children":977},{"style":104},[978],{"type":28,"value":118},{"type":23,"tag":97,"props":980,"children":981},{"style":110},[982],{"type":28,"value":554},{"type":23,"tag":97,"props":984,"children":985},{"style":104},[986],{"type":28,"value":987},"!=",{"type":23,"tag":97,"props":989,"children":990},{"style":110},[991],{"type":28,"value":992}," arr.",{"type":23,"tag":97,"props":994,"children":995},{"style":210},[996],{"type":28,"value":305},{"type":23,"tag":97,"props":998,"children":999},{"style":104},[1000],{"type":28,"value":1001}," -",{"type":23,"tag":97,"props":1003,"children":1004},{"style":210},[1005],{"type":28,"value":1006}," 1",{"type":23,"tag":97,"props":1008,"children":1009},{"style":110},[1010],{"type":28,"value":353},{"type":23,"tag":97,"props":1012,"children":1013},{"style":104},[1014],{"type":28,"value":1015},"?",{"type":23,"tag":97,"props":1017,"children":1018},{"style":126},[1019],{"type":28,"value":659},{"type":23,"tag":97,"props":1021,"children":1022},{"style":110},[1023],{"type":28,"value":1024},"(val, arr[i ",{"type":23,"tag":97,"props":1026,"children":1027},{"style":104},[1028],{"type":28,"value":1029},"+",{"type":23,"tag":97,"props":1031,"children":1032},{"style":210},[1033],{"type":28,"value":1006},{"type":23,"tag":97,"props":1035,"children":1036},{"style":110},[1037],{"type":28,"value":1038},"]) ",{"type":23,"tag":97,"props":1040,"children":1041},{"style":104},[1042],{"type":28,"value":1043},":",{"type":23,"tag":97,"props":1045,"children":1046},{"style":210},[1047],{"type":28,"value":1048}," 0",{"type":23,"tag":97,"props":1050,"children":1051},{"style":110},[1052],{"type":28,"value":1053},";\n",{"type":23,"tag":97,"props":1055,"children":1056},{"class":99,"line":313},[1057,1061,1066,1070],{"type":23,"tag":97,"props":1058,"children":1059},{"style":104},[1060],{"type":28,"value":390},{"type":23,"tag":97,"props":1062,"children":1063},{"style":110},[1064],{"type":28,"value":1065}," sum ",{"type":23,"tag":97,"props":1067,"children":1068},{"style":104},[1069],{"type":28,"value":1029},{"type":23,"tag":97,"props":1071,"children":1072},{"style":110},[1073],{"type":28,"value":1074}," t;\n",{"type":23,"tag":97,"props":1076,"children":1077},{"class":99,"line":366},[1078,1083,1088],{"type":23,"tag":97,"props":1079,"children":1080},{"style":110},[1081],{"type":28,"value":1082},"    }, ",{"type":23,"tag":97,"props":1084,"children":1085},{"style":210},[1086],{"type":28,"value":1087},"0",{"type":23,"tag":97,"props":1089,"children":1090},{"style":110},[1091],{"type":28,"value":310},{"type":23,"tag":97,"props":1093,"children":1094},{"class":99,"line":384},[1095],{"type":23,"tag":97,"props":1096,"children":1097},{"style":110},[1098],{"type":28,"value":627},{"type":23,"tag":406,"props":1100,"children":1102},{"id":1101},"producing-slideshows",[1103],{"type":28,"value":1104},"Producing Slideshows",{"type":23,"tag":24,"props":1106,"children":1107},{},[1108],{"type":28,"value":1109},"Still yet to submit a solution I decided to create a valid slideshow by splitting vertical photos and horizontal ones, paring each adjacent vertical photos and pushing them to an array, along with every horizontal photo. This in code looked like:",{"type":23,"tag":35,"props":1111,"children":1113},{"code":1112,"language":90,"meta":7,"className":91,"style":7},"function genSlides() {\n    let V = photos.filter(v => v[0] == 'V'),\n        H = photos.filter(v => v[0] == 'H'),\n        slides = [];\n\n    for (let i = 0; i \u003C V.length; i += 2) {\n        slides.push([V[i].i, V[i + 1].i]);\n    }\n\n    H.forEach(v => slides.push([v.i]));\n\n    return slides;\n}\n",[1114],{"type":23,"tag":40,"props":1115,"children":1116},{"__ignoreMap":7},[1117,1134,1200,1257,1273,1282,1351,1400,1408,1415,1458,1466,1479],{"type":23,"tag":97,"props":1118,"children":1119},{"class":99,"line":100},[1120,1124,1129],{"type":23,"tag":97,"props":1121,"children":1122},{"style":104},[1123],{"type":28,"value":431},{"type":23,"tag":97,"props":1125,"children":1126},{"style":126},[1127],{"type":28,"value":1128}," genSlides",{"type":23,"tag":97,"props":1130,"children":1131},{"style":110},[1132],{"type":28,"value":1133},"() {\n",{"type":23,"tag":97,"props":1135,"children":1136},{"class":99,"line":178},[1137,1141,1146,1151,1155,1159,1163,1167,1171,1176,1180,1185,1190,1195],{"type":23,"tag":97,"props":1138,"children":1139},{"style":104},[1140],{"type":28,"value":458},{"type":23,"tag":97,"props":1142,"children":1143},{"style":210},[1144],{"type":28,"value":1145}," V",{"type":23,"tag":97,"props":1147,"children":1148},{"style":104},[1149],{"type":28,"value":1150}," =",{"type":23,"tag":97,"props":1152,"children":1153},{"style":110},[1154],{"type":28,"value":281},{"type":23,"tag":97,"props":1156,"children":1157},{"style":126},[1158],{"type":28,"value":613},{"type":23,"tag":97,"props":1160,"children":1161},{"style":110},[1162],{"type":28,"value":134},{"type":23,"tag":97,"props":1164,"children":1165},{"style":233},[1166],{"type":28,"value":236},{"type":23,"tag":97,"props":1168,"children":1169},{"style":104},[1170],{"type":28,"value":241},{"type":23,"tag":97,"props":1172,"children":1173},{"style":110},[1174],{"type":28,"value":1175}," v[",{"type":23,"tag":97,"props":1177,"children":1178},{"style":210},[1179],{"type":28,"value":1087},{"type":23,"tag":97,"props":1181,"children":1182},{"style":110},[1183],{"type":28,"value":1184},"] ",{"type":23,"tag":97,"props":1186,"children":1187},{"style":104},[1188],{"type":28,"value":1189},"==",{"type":23,"tag":97,"props":1191,"children":1192},{"style":137},[1193],{"type":28,"value":1194}," 'V'",{"type":23,"tag":97,"props":1196,"children":1197},{"style":110},[1198],{"type":28,"value":1199},"),\n",{"type":23,"tag":97,"props":1201,"children":1202},{"class":99,"line":267},[1203,1208,1212,1216,1220,1224,1228,1232,1236,1240,1244,1248,1253],{"type":23,"tag":97,"props":1204,"children":1205},{"style":210},[1206],{"type":28,"value":1207},"        H",{"type":23,"tag":97,"props":1209,"children":1210},{"style":104},[1211],{"type":28,"value":1150},{"type":23,"tag":97,"props":1213,"children":1214},{"style":110},[1215],{"type":28,"value":281},{"type":23,"tag":97,"props":1217,"children":1218},{"style":126},[1219],{"type":28,"value":613},{"type":23,"tag":97,"props":1221,"children":1222},{"style":110},[1223],{"type":28,"value":134},{"type":23,"tag":97,"props":1225,"children":1226},{"style":233},[1227],{"type":28,"value":236},{"type":23,"tag":97,"props":1229,"children":1230},{"style":104},[1231],{"type":28,"value":241},{"type":23,"tag":97,"props":1233,"children":1234},{"style":110},[1235],{"type":28,"value":1175},{"type":23,"tag":97,"props":1237,"children":1238},{"style":210},[1239],{"type":28,"value":1087},{"type":23,"tag":97,"props":1241,"children":1242},{"style":110},[1243],{"type":28,"value":1184},{"type":23,"tag":97,"props":1245,"children":1246},{"style":104},[1247],{"type":28,"value":1189},{"type":23,"tag":97,"props":1249,"children":1250},{"style":137},[1251],{"type":28,"value":1252}," 'H'",{"type":23,"tag":97,"props":1254,"children":1255},{"style":110},[1256],{"type":28,"value":1199},{"type":23,"tag":97,"props":1258,"children":1259},{"class":99,"line":313},[1260,1265,1269],{"type":23,"tag":97,"props":1261,"children":1262},{"style":110},[1263],{"type":28,"value":1264},"        slides ",{"type":23,"tag":97,"props":1266,"children":1267},{"style":104},[1268],{"type":28,"value":118},{"type":23,"tag":97,"props":1270,"children":1271},{"style":110},[1272],{"type":28,"value":472},{"type":23,"tag":97,"props":1274,"children":1275},{"class":99,"line":366},[1276],{"type":23,"tag":97,"props":1277,"children":1279},{"emptyLinePlaceholder":1278},true,[1280],{"type":28,"value":1281},"\n",{"type":23,"tag":97,"props":1283,"children":1284},{"class":99,"line":384},[1285,1290,1295,1299,1304,1308,1312,1317,1322,1326,1330,1334,1338,1343,1347],{"type":23,"tag":97,"props":1286,"children":1287},{"style":104},[1288],{"type":28,"value":1289},"    for",{"type":23,"tag":97,"props":1291,"children":1292},{"style":110},[1293],{"type":28,"value":1294}," (",{"type":23,"tag":97,"props":1296,"children":1297},{"style":104},[1298],{"type":28,"value":107},{"type":23,"tag":97,"props":1300,"children":1301},{"style":110},[1302],{"type":28,"value":1303}," i ",{"type":23,"tag":97,"props":1305,"children":1306},{"style":104},[1307],{"type":28,"value":118},{"type":23,"tag":97,"props":1309,"children":1310},{"style":210},[1311],{"type":28,"value":1048},{"type":23,"tag":97,"props":1313,"children":1314},{"style":110},[1315],{"type":28,"value":1316},"; i ",{"type":23,"tag":97,"props":1318,"children":1319},{"style":104},[1320],{"type":28,"value":1321},"\u003C",{"type":23,"tag":97,"props":1323,"children":1324},{"style":210},[1325],{"type":28,"value":1145},{"type":23,"tag":97,"props":1327,"children":1328},{"style":110},[1329],{"type":28,"value":860},{"type":23,"tag":97,"props":1331,"children":1332},{"style":210},[1333],{"type":28,"value":305},{"type":23,"tag":97,"props":1335,"children":1336},{"style":110},[1337],{"type":28,"value":1316},{"type":23,"tag":97,"props":1339,"children":1340},{"style":104},[1341],{"type":28,"value":1342},"+=",{"type":23,"tag":97,"props":1344,"children":1345},{"style":210},[1346],{"type":28,"value":564},{"type":23,"tag":97,"props":1348,"children":1349},{"style":110},[1350],{"type":28,"value":450},{"type":23,"tag":97,"props":1352,"children":1353},{"class":99,"line":398},[1354,1359,1363,1368,1373,1378,1382,1387,1391,1395],{"type":23,"tag":97,"props":1355,"children":1356},{"style":110},[1357],{"type":28,"value":1358},"        slides.",{"type":23,"tag":97,"props":1360,"children":1361},{"style":126},[1362],{"type":28,"value":574},{"type":23,"tag":97,"props":1364,"children":1365},{"style":110},[1366],{"type":28,"value":1367},"([",{"type":23,"tag":97,"props":1369,"children":1370},{"style":210},[1371],{"type":28,"value":1372},"V",{"type":23,"tag":97,"props":1374,"children":1375},{"style":110},[1376],{"type":28,"value":1377},"[i].i, ",{"type":23,"tag":97,"props":1379,"children":1380},{"style":210},[1381],{"type":28,"value":1372},{"type":23,"tag":97,"props":1383,"children":1384},{"style":110},[1385],{"type":28,"value":1386},"[i ",{"type":23,"tag":97,"props":1388,"children":1389},{"style":104},[1390],{"type":28,"value":1029},{"type":23,"tag":97,"props":1392,"children":1393},{"style":210},[1394],{"type":28,"value":1006},{"type":23,"tag":97,"props":1396,"children":1397},{"style":110},[1398],{"type":28,"value":1399},"].i]);\n",{"type":23,"tag":97,"props":1401,"children":1402},{"class":99,"line":597},[1403],{"type":23,"tag":97,"props":1404,"children":1405},{"style":110},[1406],{"type":28,"value":1407},"    }\n",{"type":23,"tag":97,"props":1409,"children":1410},{"class":99,"line":621},[1411],{"type":23,"tag":97,"props":1412,"children":1413},{"emptyLinePlaceholder":1278},[1414],{"type":28,"value":1281},{"type":23,"tag":97,"props":1416,"children":1418},{"class":99,"line":1417},10,[1419,1424,1428,1432,1436,1440,1444,1449,1453],{"type":23,"tag":97,"props":1420,"children":1421},{"style":210},[1422],{"type":28,"value":1423},"    H",{"type":23,"tag":97,"props":1425,"children":1426},{"style":110},[1427],{"type":28,"value":860},{"type":23,"tag":97,"props":1429,"children":1430},{"style":126},[1431],{"type":28,"value":485},{"type":23,"tag":97,"props":1433,"children":1434},{"style":110},[1435],{"type":28,"value":134},{"type":23,"tag":97,"props":1437,"children":1438},{"style":233},[1439],{"type":28,"value":236},{"type":23,"tag":97,"props":1441,"children":1442},{"style":104},[1443],{"type":28,"value":241},{"type":23,"tag":97,"props":1445,"children":1446},{"style":110},[1447],{"type":28,"value":1448}," slides.",{"type":23,"tag":97,"props":1450,"children":1451},{"style":126},[1452],{"type":28,"value":574},{"type":23,"tag":97,"props":1454,"children":1455},{"style":110},[1456],{"type":28,"value":1457},"([v.i]));\n",{"type":23,"tag":97,"props":1459,"children":1461},{"class":99,"line":1460},11,[1462],{"type":23,"tag":97,"props":1463,"children":1464},{"emptyLinePlaceholder":1278},[1465],{"type":28,"value":1281},{"type":23,"tag":97,"props":1467,"children":1469},{"class":99,"line":1468},12,[1470,1474],{"type":23,"tag":97,"props":1471,"children":1472},{"style":104},[1473],{"type":28,"value":603},{"type":23,"tag":97,"props":1475,"children":1476},{"style":110},[1477],{"type":28,"value":1478}," slides;\n",{"type":23,"tag":97,"props":1480,"children":1482},{"class":99,"line":1481},13,[1483],{"type":23,"tag":97,"props":1484,"children":1485},{"style":110},[1486],{"type":28,"value":627},{"type":23,"tag":24,"props":1488,"children":1489},{},[1490],{"type":28,"value":1491},"With this I had an array that I needed to convert to the format they want, which wasn't difficult since all was required was the file system (fs) module from npm again and iterating over each value, which ended up as:",{"type":23,"tag":35,"props":1493,"children":1495},{"code":1494,"language":90,"meta":7,"className":91,"style":7},"function generateFile(slides, fileName) {\n    var stream = fs.createWriteStream(`${fileName}_export.txt`);\n    stream.once('open', function (fd) {\n        stream.write(`${slides.length}\\n`);\n        slides.forEach(v => stream.write(`${v.reduce((t, v) => t += \" \" + v, \"\")}\\n`));\n        stream.end();\n    });\n}\n",[1496],{"type":23,"tag":40,"props":1497,"children":1498},{"__ignoreMap":7},[1499,1532,1579,1622,1673,1805,1821,1828],{"type":23,"tag":97,"props":1500,"children":1501},{"class":99,"line":100},[1502,1506,1511,1515,1520,1524,1528],{"type":23,"tag":97,"props":1503,"children":1504},{"style":104},[1505],{"type":28,"value":431},{"type":23,"tag":97,"props":1507,"children":1508},{"style":126},[1509],{"type":28,"value":1510}," generateFile",{"type":23,"tag":97,"props":1512,"children":1513},{"style":110},[1514],{"type":28,"value":134},{"type":23,"tag":97,"props":1516,"children":1517},{"style":233},[1518],{"type":28,"value":1519},"slides",{"type":23,"tag":97,"props":1521,"children":1522},{"style":110},[1523],{"type":28,"value":155},{"type":23,"tag":97,"props":1525,"children":1526},{"style":233},[1527],{"type":28,"value":145},{"type":23,"tag":97,"props":1529,"children":1530},{"style":110},[1531],{"type":28,"value":450},{"type":23,"tag":97,"props":1533,"children":1534},{"class":99,"line":178},[1535,1540,1545,1549,1553,1558,1562,1566,1570,1575],{"type":23,"tag":97,"props":1536,"children":1537},{"style":104},[1538],{"type":28,"value":1539},"    var",{"type":23,"tag":97,"props":1541,"children":1542},{"style":110},[1543],{"type":28,"value":1544}," stream ",{"type":23,"tag":97,"props":1546,"children":1547},{"style":104},[1548],{"type":28,"value":118},{"type":23,"tag":97,"props":1550,"children":1551},{"style":110},[1552],{"type":28,"value":123},{"type":23,"tag":97,"props":1554,"children":1555},{"style":126},[1556],{"type":28,"value":1557},"createWriteStream",{"type":23,"tag":97,"props":1559,"children":1560},{"style":110},[1561],{"type":28,"value":134},{"type":23,"tag":97,"props":1563,"children":1564},{"style":137},[1565],{"type":28,"value":140},{"type":23,"tag":97,"props":1567,"children":1568},{"style":110},[1569],{"type":28,"value":145},{"type":23,"tag":97,"props":1571,"children":1572},{"style":137},[1573],{"type":28,"value":1574},"}_export.txt`",{"type":23,"tag":97,"props":1576,"children":1577},{"style":110},[1578],{"type":28,"value":310},{"type":23,"tag":97,"props":1580,"children":1581},{"class":99,"line":267},[1582,1587,1592,1596,1601,1605,1609,1613,1618],{"type":23,"tag":97,"props":1583,"children":1584},{"style":110},[1585],{"type":28,"value":1586},"    stream.",{"type":23,"tag":97,"props":1588,"children":1589},{"style":126},[1590],{"type":28,"value":1591},"once",{"type":23,"tag":97,"props":1593,"children":1594},{"style":110},[1595],{"type":28,"value":134},{"type":23,"tag":97,"props":1597,"children":1598},{"style":137},[1599],{"type":28,"value":1600},"'open'",{"type":23,"tag":97,"props":1602,"children":1603},{"style":110},[1604],{"type":28,"value":155},{"type":23,"tag":97,"props":1606,"children":1607},{"style":104},[1608],{"type":28,"value":431},{"type":23,"tag":97,"props":1610,"children":1611},{"style":110},[1612],{"type":28,"value":1294},{"type":23,"tag":97,"props":1614,"children":1615},{"style":233},[1616],{"type":28,"value":1617},"fd",{"type":23,"tag":97,"props":1619,"children":1620},{"style":110},[1621],{"type":28,"value":450},{"type":23,"tag":97,"props":1623,"children":1624},{"class":99,"line":313},[1625,1630,1635,1639,1643,1647,1651,1655,1660,1664,1669],{"type":23,"tag":97,"props":1626,"children":1627},{"style":110},[1628],{"type":28,"value":1629},"        stream.",{"type":23,"tag":97,"props":1631,"children":1632},{"style":126},[1633],{"type":28,"value":1634},"write",{"type":23,"tag":97,"props":1636,"children":1637},{"style":110},[1638],{"type":28,"value":134},{"type":23,"tag":97,"props":1640,"children":1641},{"style":137},[1642],{"type":28,"value":140},{"type":23,"tag":97,"props":1644,"children":1645},{"style":110},[1646],{"type":28,"value":1519},{"type":23,"tag":97,"props":1648,"children":1649},{"style":137},[1650],{"type":28,"value":860},{"type":23,"tag":97,"props":1652,"children":1653},{"style":210},[1654],{"type":28,"value":305},{"type":23,"tag":97,"props":1656,"children":1657},{"style":137},[1658],{"type":28,"value":1659},"}",{"type":23,"tag":97,"props":1661,"children":1662},{"style":210},[1663],{"type":28,"value":213},{"type":23,"tag":97,"props":1665,"children":1666},{"style":137},[1667],{"type":28,"value":1668},"`",{"type":23,"tag":97,"props":1670,"children":1671},{"style":110},[1672],{"type":28,"value":310},{"type":23,"tag":97,"props":1674,"children":1675},{"class":99,"line":366},[1676,1680,1684,1688,1692,1696,1701,1705,1709,1713,1717,1721,1725,1729,1734,1738,1742,1746,1750,1755,1760,1765,1770,1775,1779,1784,1789,1793,1797,1801],{"type":23,"tag":97,"props":1677,"children":1678},{"style":110},[1679],{"type":28,"value":1358},{"type":23,"tag":97,"props":1681,"children":1682},{"style":126},[1683],{"type":28,"value":485},{"type":23,"tag":97,"props":1685,"children":1686},{"style":110},[1687],{"type":28,"value":134},{"type":23,"tag":97,"props":1689,"children":1690},{"style":233},[1691],{"type":28,"value":236},{"type":23,"tag":97,"props":1693,"children":1694},{"style":104},[1695],{"type":28,"value":241},{"type":23,"tag":97,"props":1697,"children":1698},{"style":110},[1699],{"type":28,"value":1700}," stream.",{"type":23,"tag":97,"props":1702,"children":1703},{"style":126},[1704],{"type":28,"value":1634},{"type":23,"tag":97,"props":1706,"children":1707},{"style":110},[1708],{"type":28,"value":134},{"type":23,"tag":97,"props":1710,"children":1711},{"style":137},[1712],{"type":28,"value":140},{"type":23,"tag":97,"props":1714,"children":1715},{"style":110},[1716],{"type":28,"value":236},{"type":23,"tag":97,"props":1718,"children":1719},{"style":137},[1720],{"type":28,"value":860},{"type":23,"tag":97,"props":1722,"children":1723},{"style":126},[1724],{"type":28,"value":914},{"type":23,"tag":97,"props":1726,"children":1727},{"style":137},[1728],{"type":28,"value":335},{"type":23,"tag":97,"props":1730,"children":1731},{"style":210},[1732],{"type":28,"value":1733},"t",{"type":23,"tag":97,"props":1735,"children":1736},{"style":137},[1737],{"type":28,"value":155},{"type":23,"tag":97,"props":1739,"children":1740},{"style":210},[1741],{"type":28,"value":236},{"type":23,"tag":97,"props":1743,"children":1744},{"style":137},[1745],{"type":28,"value":353},{"type":23,"tag":97,"props":1747,"children":1748},{"style":104},[1749],{"type":28,"value":358},{"type":23,"tag":97,"props":1751,"children":1752},{"style":110},[1753],{"type":28,"value":1754}," t",{"type":23,"tag":97,"props":1756,"children":1757},{"style":104},[1758],{"type":28,"value":1759}," +=",{"type":23,"tag":97,"props":1761,"children":1762},{"style":137},[1763],{"type":28,"value":1764}," \" \"",{"type":23,"tag":97,"props":1766,"children":1767},{"style":104},[1768],{"type":28,"value":1769}," +",{"type":23,"tag":97,"props":1771,"children":1772},{"style":110},[1773],{"type":28,"value":1774}," v",{"type":23,"tag":97,"props":1776,"children":1777},{"style":137},[1778],{"type":28,"value":155},{"type":23,"tag":97,"props":1780,"children":1781},{"style":137},[1782],{"type":28,"value":1783},"\"\"",{"type":23,"tag":97,"props":1785,"children":1786},{"style":137},[1787],{"type":28,"value":1788},")",{"type":23,"tag":97,"props":1790,"children":1791},{"style":137},[1792],{"type":28,"value":1659},{"type":23,"tag":97,"props":1794,"children":1795},{"style":210},[1796],{"type":28,"value":213},{"type":23,"tag":97,"props":1798,"children":1799},{"style":137},[1800],{"type":28,"value":1668},{"type":23,"tag":97,"props":1802,"children":1803},{"style":110},[1804],{"type":28,"value":264},{"type":23,"tag":97,"props":1806,"children":1807},{"class":99,"line":384},[1808,1812,1817],{"type":23,"tag":97,"props":1809,"children":1810},{"style":110},[1811],{"type":28,"value":1629},{"type":23,"tag":97,"props":1813,"children":1814},{"style":126},[1815],{"type":28,"value":1816},"end",{"type":23,"tag":97,"props":1818,"children":1819},{"style":110},[1820],{"type":28,"value":175},{"type":23,"tag":97,"props":1822,"children":1823},{"class":99,"line":398},[1824],{"type":23,"tag":97,"props":1825,"children":1826},{"style":110},[1827],{"type":28,"value":404},{"type":23,"tag":97,"props":1829,"children":1830},{"class":99,"line":597},[1831],{"type":23,"tag":97,"props":1832,"children":1833},{"style":110},[1834],{"type":28,"value":627},{"type":23,"tag":24,"props":1836,"children":1837},{},[1838],{"type":28,"value":1839},"With this I was able to wrap these up in a forEach function going over each filename, computing the slides and generating the results, which I've now added logged timings for every calculation of files.",{"type":23,"tag":35,"props":1841,"children":1843},{"code":1842},"5ms: a_example - 0\n961ms: b_lovely_landscapes - 10\n10ms: c_memorable_moments - 124\n556ms: d_pet_pictures - 161691\n1411ms: e_shiny_selfies - 101460\nScore: 263285    Time: 2.95s\n",[1844],{"type":23,"tag":40,"props":1845,"children":1846},{"__ignoreMap":7},[1847],{"type":28,"value":1842},{"type":23,"tag":24,"props":1849,"children":1850},{},[1851],{"type":28,"value":1852},"As you can see it only took under 3 seconds to generate output with scores not all being 0 (this is being ran afterwards so is not 100% accurate to when ran at Hash Code, it did score around 330,000), which were ready to submit and did initially give us a rank of 5 on the UoM leaderboard, but when I tweeted out someone had gotten a slightly better score than us (by a few hundred)",{"type":23,"tag":1854,"props":1855,"children":1859},"blockquote",{"className":1856,"dataDnt":1858},[1857],"twitter-tweet","true",[1860,1875,1877],{"type":23,"tag":24,"props":1861,"children":1864},{"lang":1862,"dir":1863},"en","ltr",[1865,1867,1873],{"type":28,"value":1866},"I'm competing in the ",{"type":23,"tag":668,"props":1868,"children":1870},{"href":1869},"https://twitter.com/hashtag/HashCode?src=hash&ref_src=twsrc%5Etfw",[1871],{"type":28,"value":1872},"#HashCode",{"type":28,"value":1874}," Online Qualification Round and my team is currently in 6th place at United Kingdom / University of Manchester!",{"type":28,"value":1876},"-- 🧙♂️ Sean O'Mahoney (@Sean12697) ",{"type":23,"tag":668,"props":1878,"children":1880},{"href":1879},"https://twitter.com/Sean12697/status/1101209599091376129?ref_src=twsrc%5Etfw",[1881],{"type":28,"value":1882},"February 28, 2019",{"type":23,"tag":1884,"props":1885,"children":1888},"script",{"async":1278,"src":1886,"charSet":1887},"https://platform.twitter.com/widgets.js","utf-8",[],{"type":23,"tag":406,"props":1890,"children":1892},{"id":1891},"optimizing-attempts",[1893],{"type":28,"value":1894},"Optimizing Attempts",{"type":23,"tag":24,"props":1896,"children":1897},{},[1898],{"type":28,"value":1899},"The second thought I had was to scatter the arrays of slides an arbitrary amount of times and use the eval function I had created to get the best slides of closely paired vertical photos (which still needed improving).",{"type":23,"tag":24,"props":1901,"children":1902},{},[1903],{"type":28,"value":1904},"For unknowns reasons it occasionally gave worse results (shown below) which I knew not to submit, but then did make me try and use a similar function on the pairing of vertical photos and permutations over the best randomly paired vertical photos, with the shuffled slides of those.",{"type":23,"tag":35,"props":1906,"children":1908},{"code":1907},"7ms: a_example - 1\n35777ms: b_lovely_landscapes - 14\n209ms: c_memorable_moments - 104\n19915ms: d_pet_pictures - 147488\n60242ms: e_shiny_selfies - 101358\nScore: 248965    Time: 116.15s\n",[1909],{"type":23,"tag":40,"props":1910,"children":1911},{"__ignoreMap":7},[1912],{"type":28,"value":1907},{"type":23,"tag":24,"props":1914,"children":1915},{},[1916,1918,1924],{"type":28,"value":1917},"Eventually one of my other team members found a more elegant solution in C# which did take longer (the last submission for file ",{"type":23,"tag":40,"props":1919,"children":1921},{"className":1920},[],[1922],{"type":28,"value":1923},"e_shiny_selfies",{"type":28,"value":1925}," was 4 minutes before the deadline), which I will review, but with that it pushed us up 4 places to #2 and settled our place there by a significant amount (being hundreds of thousands above everyone else, but still around 200,000 below the team at number one).",{"type":23,"tag":1854,"props":1927,"children":1929},{"className":1928},[1857],[1930,1941,1942],{"type":23,"tag":24,"props":1931,"children":1932},{"lang":1862,"dir":1863},[1933,1935,1939],{"type":28,"value":1934},"Woohoo! My team, Out of Bounds, came in 2nd place overall in the ",{"type":23,"tag":668,"props":1936,"children":1937},{"href":1869},[1938],{"type":28,"value":1872},{"type":28,"value":1940}," Online Qualification Round at United Kingdom / University of Manchester. Our final score was 719912. 🏆",{"type":28,"value":1876},{"type":23,"tag":668,"props":1943,"children":1945},{"href":1944},"https://twitter.com/Sean12697/status/1101238831670534149?ref_src=twsrc%5Etfw",[1946],{"type":28,"value":1882},{"type":23,"tag":1884,"props":1948,"children":1949},{"async":1278,"src":1886,"charSet":1887},[],{"type":23,"tag":24,"props":1951,"children":1952},{},[1953],{"type":28,"value":1954},"I am aware trying to pair vertical photos with more varying tags next to horizontal photos with many would have likely yielded greater results, although producing an algorithm in the few hours we had could have led us in the same predicament me and my team last year were in (not submitting anything in time).",{"type":23,"tag":24,"props":1956,"children":1957},{},[1958,1960,1968,1970,1977],{"type":28,"value":1959},"I have pushed it to ",{"type":23,"tag":668,"props":1961,"children":1965},{"href":1962,"rel":1963},"https://github.com/Sean12697/HashCode2019/",[1964],"nofollow",[1966],{"type":28,"value":1967},"GitHub",{"type":28,"value":1969}," although did do so later on, meaning the iterations I did to try and shuffle the vertical photos are not there and now have added timings if you do want to run the script yourself (change ",{"type":23,"tag":668,"props":1971,"children":1974},{"href":1972,"rel":1973},"https://github.com/Sean12697/HashCode2019/blob/2d75560e9f6534f2123ae5ce5a276609f17417ea/script.js#L19",[1964],[1975],{"type":28,"value":1976},"this",{"type":28,"value":1978}," if you want to see the time difference between just generating slides, and trying to get the best).",{"type":23,"tag":1980,"props":1981,"children":1982},"style",{},[1983],{"type":28,"value":1984},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":178,"depth":178,"links":1986},[1987],{"id":65,"depth":178,"text":68,"children":1988},[1989,1990,1991],{"id":408,"depth":267,"text":411},{"id":1101,"depth":267,"text":1104},{"id":1891,"depth":267,"text":1894},"markdown","content:posts:2019-02-28-google-hash-code-2019.md","content","posts/2019-02-28-google-hash-code-2019.md","posts/2019-02-28-google-hash-code-2019","md",1779024903128]