The very best NES games.

another list of best NES games, NOT!

What happens if you take (nearly) all "best NES" "top 10 NES" "top 100 NES" lists that can be found online, and compile the ultimate best NES game list from it? Thats how this list was made.

Here you have it:

(you can zoom out, pan around, its 159 games long)

How was this made? First define the source lists, second extract the raw lists from the websites, third compile the data, make a chart and then write this post here.

Why? With all the possible options to play NES games today (XBOX, PSP, ...) its always nice to see what else can be played. Plus a bit of code practise with web scraping and data analysis is fun 😎

Webscraping

All the lists where automatically searched and the list extractet. This list was then stored as Json File.  I used Python, and the Beautiful Soup package to extract the data:

Here is such a extractor code:

def extract(URL):
    resultlist = {}
    resultlist['url'] = URL
    website = requests.get(URL)
    results = BeautifulSoup(website.content, 'html.parser')
    # the list is inside the li's with list-item
    r = results.find_all('span', {"class": "ez-toc-section"})
    res = []
    for x in range(0, 100):
        res.append(r[x].nextSibling.text)
    resultlist['list'] = res
    resultlist['listlen'] = len(res)
    return resultlist

All the JSON files in a folder then get combined in a big list, giving the overal result. Like this the scraping needs to be done only once and you can work on the data analysis later.

    # load all jsons in the folder
    path_to_json = listfolder
    json_files = [pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')]
    print(json_files)
    loadedfiles = []
    for json in json_files:
        loadedfiles.append(pd.read_json(path_to_json + "/" + json))
    print(loadedfiles[0]['list'])
    bigdict = dict()
    for list in loadedfiles:
        for idx, game in enumerate(list["list"]):
            if game not in bigdict:
                bigdict[game] = 100 - math.log(idx+1)*21.71
            else:
                bigdict[game] = bigdict[game] + (100 - math.log(idx+1)*21.71)
                # print(f"already here {game}")
    sortdict = dict(sorted(bigdict.items(), key=lambda item: item[1], reverse=True))

And then only the chart is left, thats done with plotly and the result can be seen at the top!

More?

And now? Collect all this best NES games, extract the ROM´s, or play it on real hardware.

Comments powered by CComment