2018年12月30日日曜日

開発環境

実行速度より作業の速さで、コードの読みやすさと短さ、そして最新のJavaScript(ECMAScript)っぽさ(let、filter、テンプレート文字列を利用)を重視したコードに書き直してみた。

コード(Emacs)

HTML5

<script src="sample83.js"></script>

JavaScript(ECMAScript)

let txt = '[{"IsRated":true,"Place":432,"NewRating":32,"Performance":587,"InnerPerformance":587,"ContestScreenName":"abc069.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 069","EndTime":"2017-08-06T22:40:00+09:00"},{"IsRated":true,"Place":1054,"NewRating":76,"Performance":375,"InnerPerformance":375,"ContestScreenName":"abc073.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 073","EndTime":"2017-09-09T22:40:00+09:00"},{"IsRated":true,"Place":222,"NewRating":208,"Performance":967,"InnerPerformance":967,"ContestScreenName":"abc074.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 074","EndTime":"2017-09-16T22:40:00+09:00"},{"IsRated":true,"Place":1215,"NewRating":314,"Performance":835,"InnerPerformance":835,"ContestScreenName":"code-festival-2017-quala.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2017 qual A","EndTime":"2017-09-23T23:00:00+09:00"},{"IsRated":true,"Place":40,"NewRating":664,"Performance":1600,"InnerPerformance":1891,"ContestScreenName":"tenka1-2017-beginner.contest.atcoder.jp","ContestName":"Tenka1 Programmer Beginner Contest","EndTime":"2017-09-30T22:40:00+09:00"},{"IsRated":false,"Place":411,"NewRating":664,"Performance":0,"InnerPerformance":0,"ContestScreenName":"ddcc2017-qual.contest.atcoder.jp","ContestName":"DISCO presents ディスカバリーチャンネル コードコンテスト2017 予選","EndTime":"2017-10-07T22:30:00+09:00"},{"IsRated":true,"Place":529,"NewRating":883,"Performance":1625,"InnerPerformance":1625,"ContestScreenName":"code-festival-2017-qualb.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2017 qual B","EndTime":"2017-10-08T23:00:00+09:00"},{"IsRated":true,"Place":230,"NewRating":1018,"Performance":1580,"InnerPerformance":1580,"ContestScreenName":"abc075.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 075","EndTime":"2017-10-14T22:40:00+09:00"},{"IsRated":true,"Place":581,"NewRating":1100,"Performance":1505,"InnerPerformance":1505,"ContestScreenName":"code-festival-2017-qualc.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2017 qual C","EndTime":"2017-10-22T23:00:00+09:00"},{"IsRated":true,"Place":163,"NewRating":1181,"Performance":1600,"InnerPerformance":1754,"ContestScreenName":"abc076.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 076","EndTime":"2017-10-28T22:40:00+09:00"},{"IsRated":true,"Place":41,"NewRating":1245,"Performance":1600,"InnerPerformance":1607,"ContestScreenName":"abc077.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 077","EndTime":"2017-11-04T22:40:00+09:00"},{"IsRated":true,"Place":181,"NewRating":1376,"Performance":2013,"InnerPerformance":2013,"ContestScreenName":"arc085.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 085","EndTime":"2017-11-11T22:40:00+09:00"},{"IsRated":false,"Place":211,"NewRating":1376,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc079.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 079","EndTime":"2017-11-18T22:40:00+09:00"},{"IsRated":true,"Place":74,"NewRating":1475,"Performance":2001,"InnerPerformance":2001,"ContestScreenName":"cf17-final-open.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2017 Final (Parallel)","EndTime":"2017-11-25T15:30:00+09:00"},{"IsRated":false,"Place":78,"NewRating":1475,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc080.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 080","EndTime":"2017-12-03T22:40:00+09:00"},{"IsRated":true,"Place":393,"NewRating":1480,"Performance":1526,"InnerPerformance":1526,"ContestScreenName":"arc086.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 086","EndTime":"2017-12-10T22:40:00+09:00"},{"IsRated":true,"Place":173,"NewRating":1546,"Performance":1949,"InnerPerformance":1949,"ContestScreenName":"arc087.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 087","EndTime":"2017-12-16T22:40:00+09:00"},{"IsRated":true,"Place":142,"NewRating":1631,"Performance":2127,"InnerPerformance":2127,"ContestScreenName":"arc088.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 088","EndTime":"2017-12-23T22:40:00+09:00"},{"IsRated":false,"Place":55,"NewRating":1631,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc084.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 084","EndTime":"2017-12-30T22:40:00+09:00"},{"IsRated":false,"Place":625,"NewRating":1631,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc085.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 085","EndTime":"2018-01-07T22:40:00+09:00"},{"IsRated":false,"Place":196,"NewRating":1631,"Performance":0,"InnerPerformance":0,"ContestScreenName":"dwacon2018-prelims.contest.atcoder.jp","ContestName":"第4回 ドワンゴからの挑戦状 予選","EndTime":"2018-01-13T22:00:00+09:00"},{"IsRated":true,"Place":786,"NewRating":1607,"Performance":1412,"InnerPerformance":1412,"ContestScreenName":"agc020.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 020","EndTime":"2018-01-14T23:10:00+09:00"},{"IsRated":false,"Place":41,"NewRating":1607,"Performance":0,"InnerPerformance":0,"ContestScreenName":"colopl2018-final-open.contest.atcoder.jp","ContestName":"COLOCON -Colopl programming contest 2018- Final(オープンコンテスト)","EndTime":"2018-01-20T16:10:00+09:00"},{"IsRated":true,"Place":102,"NewRating":1727,"Performance":2391,"InnerPerformance":2391,"ContestScreenName":"arc089.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 089","EndTime":"2018-01-21T22:40:00+09:00"},{"IsRated":false,"Place":94,"NewRating":1727,"Performance":0,"InnerPerformance":0,"ContestScreenName":"soundhound2018.contest.atcoder.jp","ContestName":"SoundHound Inc. Programming Contest 2018 (春)","EndTime":"2018-01-27T22:30:00+09:00"},{"IsRated":true,"Place":432,"NewRating":1723,"Performance":1687,"InnerPerformance":1687,"ContestScreenName":"arc090.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 090","EndTime":"2018-01-28T22:40:00+09:00"},{"IsRated":true,"Place":222,"NewRating":1749,"Performance":1946,"InnerPerformance":1946,"ContestScreenName":"apc001.contest.atcoder.jp","ContestName":"AtCoder Petrozavodsk Contest 001","EndTime":"2018-02-04T04:00:00+09:00"},{"IsRated":false,"Place":286,"NewRating":1749,"Performance":0,"InnerPerformance":0,"ContestScreenName":"yahoo-procon2018-qual.contest.atcoder.jp","ContestName":"「みんなのプロコン 2018」","EndTime":"2018-02-10T23:00:00+09:00"},{"IsRated":false,"Place":176,"NewRating":1749,"Performance":0,"InnerPerformance":0,"ContestScreenName":"rco-contest-2018-qual.contest.atcoder.jp","ContestName":"第2回 RCO日本橋ハーフマラソン 予選","EndTime":"2018-02-11T23:00:00+09:00"},{"IsRated":false,"Place":225,"NewRating":1749,"Performance":0,"InnerPerformance":0,"ContestScreenName":"future-contest-2018-qual.contest.atcoder.jp","ContestName":"HACK TO THE FUTURE 2018予選","EndTime":"2018-02-17T22:00:00+09:00"},{"IsRated":false,"Place":140,"NewRating":1749,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc088.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 088","EndTime":"2018-02-18T22:40:00+09:00"},{"IsRated":true,"Place":391,"NewRating":1747,"Performance":1728,"InnerPerformance":1728,"ContestScreenName":"agc021.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 021","EndTime":"2018-02-24T22:50:00+09:00"},{"IsRated":false,"Place":43,"NewRating":1747,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc089.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 089","EndTime":"2018-03-04T22:40:00+09:00"},{"IsRated":true,"Place":323,"NewRating":1746,"Performance":1744,"InnerPerformance":1744,"ContestScreenName":"arc091.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 091","EndTime":"2018-03-11T22:40:00+09:00"},{"IsRated":true,"Place":521,"NewRating":1705,"Performance":1291,"InnerPerformance":1291,"ContestScreenName":"arc092.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 092","EndTime":"2018-03-17T22:40:00+09:00"},{"IsRated":true,"Place":138,"NewRating":1753,"Performance":2095,"InnerPerformance":2095,"ContestScreenName":"arc093.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 093","EndTime":"2018-03-25T22:40:00+09:00"},{"IsRated":true,"Place":380,"NewRating":1744,"Performance":1668,"InnerPerformance":1668,"ContestScreenName":"agc022.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 022","EndTime":"2018-04-01T02:30:00+09:00"},{"IsRated":true,"Place":190,"NewRating":1775,"Performance":2004,"InnerPerformance":2004,"ContestScreenName":"arc094.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 094","EndTime":"2018-04-07T22:40:00+09:00"},{"IsRated":true,"Place":137,"NewRating":1827,"Performance":2195,"InnerPerformance":2195,"ContestScreenName":"arc095.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 095","EndTime":"2018-04-14T22:50:00+09:00"},{"IsRated":true,"Place":569,"NewRating":1787,"Performance":1382,"InnerPerformance":1382,"ContestScreenName":"arc096.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 096","EndTime":"2018-04-21T22:40:00+09:00"},{"IsRated":true,"Place":314,"NewRating":1807,"Performance":1965,"InnerPerformance":1965,"ContestScreenName":"agc023.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 023","EndTime":"2018-04-28T23:20:00+09:00"},{"IsRated":false,"Place":32,"NewRating":1807,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc096.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 096","EndTime":"2018-05-05T22:40:00+09:00"},{"IsRated":true,"Place":84,"NewRating":1881,"Performance":2380,"InnerPerformance":2380,"ContestScreenName":"arc097.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 097","EndTime":"2018-05-12T22:40:00+09:00"},{"IsRated":true,"Place":408,"NewRating":1880,"Performance":1866,"InnerPerformance":1866,"ContestScreenName":"agc024.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 024","EndTime":"2018-05-20T23:10:00+09:00"},{"IsRated":true,"Place":178,"NewRating":1901,"Performance":2074,"InnerPerformance":2074,"ContestScreenName":"arc098.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 098","EndTime":"2018-05-26T22:40:00+09:00"},{"IsRated":false,"Place":74,"NewRating":1901,"Performance":0,"InnerPerformance":0,"ContestScreenName":"bitflyer2018-qual.contest.atcoder.jp","ContestName":"codeFlyer (bitFlyer Programming Contest)","EndTime":"2018-06-02T23:00:00+09:00"},{"IsRated":true,"Place":266,"NewRating":1926,"Performance":2121,"InnerPerformance":2121,"ContestScreenName":"agc025.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 025","EndTime":"2018-06-03T23:10:00+09:00"},{"IsRated":false,"Place":17,"NewRating":1926,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc099.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 099","EndTime":"2018-06-10T22:40:00+09:00"},{"IsRated":false,"Place":618,"NewRating":1926,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc100.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 100","EndTime":"2018-06-16T22:40:00+09:00"},{"IsRated":true,"Place":331,"NewRating":1916,"Performance":1825,"InnerPerformance":1825,"ContestScreenName":"arc099.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 099","EndTime":"2018-06-23T22:40:00+09:00"},{"IsRated":true,"Place":66,"NewRating":1993,"Performance":2512,"InnerPerformance":2512,"ContestScreenName":"arc100.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 100","EndTime":"2018-07-01T22:10:00+09:00"},{"IsRated":true,"Place":117,"NewRating":2023,"Performance":2259,"InnerPerformance":2259,"ContestScreenName":"soundhound2018-summer-qual.contest.atcoder.jp","ContestName":"SoundHound Inc. Programming Contest 2018 -Masters Tournament-","EndTime":"2018-07-07T23:00:00+09:00"},{"IsRated":true,"Place":115,"NewRating":2091,"Performance":2564,"InnerPerformance":2564,"ContestScreenName":"agc026.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 026","EndTime":"2018-07-14T23:30:00+09:00"},{"IsRated":false,"Place":32,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc103.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 103","EndTime":"2018-07-21T22:40:00+09:00"},{"IsRated":false,"Place":60,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"soundhound2018-summer-final-open.contest.atcoder.jp","ContestName":"SoundHound Programming Contest 2018 Masters Tournament 本戦 (Open)","EndTime":"2018-07-28T17:00:00+09:00"},{"IsRated":false,"Place":163,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"mujin-pc-2018.contest.atcoder.jp","ContestName":"Mujin Programming Challenge 2018","EndTime":"2018-08-04T23:00:00+09:00"},{"IsRated":false,"Place":19,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc104.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 104","EndTime":"2018-08-05T22:40:00+09:00"},{"IsRated":false,"Place":9,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc105.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 105","EndTime":"2018-08-11T22:40:00+09:00"},{"IsRated":false,"Place":7,"NewRating":2091,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc106.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 106","EndTime":"2018-08-18T22:40:00+09:00"},{"IsRated":true,"Place":103,"NewRating":2113,"Performance":2294,"InnerPerformance":2294,"ContestScreenName":"arc101.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 101","EndTime":"2018-08-25T22:40:00+09:00"},{"IsRated":true,"Place":149,"NewRating":2115,"Performance":2135,"InnerPerformance":2135,"ContestScreenName":"arc102.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 102","EndTime":"2018-09-01T22:40:00+09:00"},{"IsRated":false,"Place":120,"NewRating":2115,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc109.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 109","EndTime":"2018-09-08T22:40:00+09:00"},{"IsRated":true,"Place":230,"NewRating":2121,"Performance":2167,"InnerPerformance":2167,"ContestScreenName":"agc027.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 027","EndTime":"2018-09-15T23:20:00+09:00"},{"IsRated":false,"Place":100,"NewRating":2121,"Performance":0,"InnerPerformance":0,"ContestScreenName":"code-festival-2018-quala.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2018 qual A","EndTime":"2018-09-22T23:00:00+09:00"},{"IsRated":true,"Place":159,"NewRating":2126,"Performance":2174,"InnerPerformance":2174,"ContestScreenName":"arc103.contest.atcoder.jp","ContestName":"AtCoder Regular Contest 103","EndTime":"2018-09-29T22:40:00+09:00"},{"IsRated":false,"Place":2,"NewRating":2126,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc112.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 112","EndTime":"2018-10-06T22:40:00+09:00"},{"IsRated":true,"Place":408,"NewRating":2098,"Performance":1808,"InnerPerformance":1808,"ContestScreenName":"agc028.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 028","EndTime":"2018-10-13T23:30:00+09:00"},{"IsRated":false,"Place":44,"NewRating":2098,"Performance":0,"InnerPerformance":0,"ContestScreenName":"code-festival-2018-qualb.contest.atcoder.jp","ContestName":"CODE FESTIVAL 2018 qual B","EndTime":"2018-10-14T23:00:00+09:00"},{"IsRated":true,"Place":99,"NewRating":2123,"Performance":2327,"InnerPerformance":2327,"ContestScreenName":"tenka1-2018.contest.atcoder.jp","ContestName":"Tenka1 Programmer Contest","EndTime":"2018-10-27T22:40:00+09:00"},{"IsRated":false,"Place":68,"NewRating":2123,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc113.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 113","EndTime":"2018-11-04T22:40:00+09:00"},{"IsRated":false,"Place":95,"NewRating":2123,"Performance":0,"InnerPerformance":0,"ContestScreenName":"ddcc2019-qual.contest.atcoder.jp","ContestName":"DISCO presents ディスカバリーチャンネル コードコンテスト2019 予選","EndTime":"2018-11-23T22:30:00+09:00"},{"IsRated":true,"Place":69,"NewRating":2168,"Performance":2503,"InnerPerformance":2503,"ContestScreenName":"dwacon5th-prelims.contest.atcoder.jp","ContestName":"Dwango Programming Contest V / 第5回 ドワンゴからの挑戦状 予選","EndTime":"2018-11-24T22:00:00+09:00"},{"IsRated":false,"Place":10,"NewRating":2168,"Performance":0,"InnerPerformance":0,"ContestScreenName":"code-thanks-festival-2018-open.contest.atcoder.jp","ContestName":"CODE THANKS FESTIVAL 2018(Parallel)","EndTime":"2018-11-25T15:00:00+09:00"},{"IsRated":false,"Place":14,"NewRating":2168,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc114.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 114","EndTime":"2018-12-02T22:40:00+09:00"},{"IsRated":false,"Place":17,"NewRating":2168,"Performance":0,"InnerPerformance":0,"ContestScreenName":"abc115.contest.atcoder.jp","ContestName":"AtCoder Beginner Contest 115","EndTime":"2018-12-08T22:50:00+09:00"},{"IsRated":true,"Place":382,"NewRating":2144,"Performance":1909,"InnerPerformance":1909,"ContestScreenName":"agc029.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 029","EndTime":"2018-12-15T23:20:00+09:00"},{"IsRated":true,"Place":232,"NewRating":2124,"Performance":1922,"InnerPerformance":1922,"ContestScreenName":"caddi2018.contest.atcoder.jp","ContestName":"CADDi 2018","EndTime":"2018-12-22T23:00:00+09:00"},{"IsRated":true,"Place":250,"NewRating":2123,"Performance":2118,"InnerPerformance":2118,"ContestScreenName":"agc030.contest.atcoder.jp","ContestName":"AtCoder Grand Contest 030","EndTime":"2018-12-29T22:50:00+09:00"}]',
    now = JSON.parse(txt).filter(x => x.EndTime > '2018'),
    contest = now.length,
    rated = now.filter(n => n.IsRated === true).length;

console.log(`コンテストの参加回数 : ${contest}`);
console.log(`rated参加回数 : ${rated}`);

入出力結果(Console)

コンテストの参加回数 : 59
rated参加回数 : 31

0 コメント:

コメントを投稿

関連コンテンツ