URI: 
        _______               __                   _______
       |   |   |.---.-..----.|  |--..-----..----. |    |  |.-----..--.--.--..-----.
       |       ||  _  ||  __||    < |  -__||   _| |       ||  -__||  |  |  ||__ --|
       |___|___||___._||____||__|__||_____||__|   |__|____||_____||________||_____|
                                                             on Gopher (inofficial)
  HTML Visit Hacker News on the Web
       
       
       COMMENT PAGE FOR:
  HTML   Show HN: I built an 8-bit CPU simulator in Python from scratch
       
       
        alienbaby wrote 14 min ago:
        Nice. I wrote something exactly like this to simulate a CPU with an
        instruction set and registers that were extended beyond general purpose
        instructions to include op codes to read board state and generate moves
        for a game of go. That then became the core of a system setup to use
        genetic algorithms to try and 'breed' go playing programs.
        
        It didn't produce anything close to a competent go playing program, but
        it did get to the point it would play legal moves, which considering I
        started it with a purely randomly generated population of programs, it
        had zero built in knowledge of the rules of go, and had it playing
        against a well known open source go playing program to assess fitness
        of a given pop, I was quite pleased with it.
        
        This was around 10+ years ago, just as Google made alphago.
       
        csmantle wrote 40 min ago:
        This is a single-cycle, architecture-level simulator with no microarch
        details or "complex" features (privileged infra, mapped memory, etc).
        But it is a good starting demo.
        
        BTW, why invent Yet-Another-Toy-Arch(tm)? If a more established
        architecture is used, existing toolchains can be utilized to produce
        images for running. Many popular RISC ISAs have "simplified" editions
        which are void of many complex features, so they hardly need more
        efforts to implement with respect to this one.
       
        dd_xplore wrote 1 hour 20 min ago:
        AI slop
       
        noobermin wrote 1 hour 37 min ago:
        Just a note, it's very clear the OP's associated account was an attempt
        at an AI managed account created for HN 5 days ago, looking at their
        post history and their single comment. I'm not sure about this post in
        particular but it is strange that you have a full 8-bit CPU simulator
        with no history older than 4 days ago, full with comments on each
        function. It's likely this "CPU simulator" is AI-generated and in fact
        not from scratch. Of course, it's possible you had a rather polished,
        from scratch project the OP polished on their own PC before uploading
        to github. That said, their first post already cast some doubt.
        
        I'm not sure if this is in the spirit of "Show HN" because really
        anyone can do this.
       
          rf15 wrote 49 min ago:
          The whole  is a dead giveaway for AI project/farming.
       
          parados wrote 1 hour 2 min ago:
          Sort-of agree, but then I saw this code in the Visualiser[0]
          
              try:
              import matplotlib.pyplot as plt
              except Exception:
              plt = None
              
              class Visualizer:
              
              def animate_combined(
                  # Stuff...
              ):
                  # Stuff...
                  try:
                  import numpy as np
                  except Exception:
                  print("numpy is required for animation")
                  return
                  if plt is None:
                  print("matplotlib not available - cannot animate")
                  return
          
          Is AI really that bad? Or has it been written by a human?
          
          [0]
          
  HTML    [1]: https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/visuali...
       
            85392_school wrote 14 min ago:
            AI is penalized for any and all emitted errors through RL, so this
            kind of carefulness is actually a strong sign of AI.
       
            Mumps wrote 24 min ago:
            Other giveaways like insistence on
            
            `from typing import List`
            
            (I'm yet to see a model be trained on modern-biased python enough
            to not bother with that import)
       
            noobermin wrote 41 min ago:
            I mean, it's not impossible to get bad AI code, no?
            
            Anyway, as I said in a comment below, Show HN already has
            vibe-coded projects in it, much less merely AI assisted works, the
            problem here is the title that says it is "from scratch" which most
            readers would assume means it is written by hand.
       
          fortran77 wrote 1 hour 3 min ago:
          Is there really any value to a fake HN account? What’s the
          motivation?
       
            cluckindan wrote 56 min ago:
            Karma farming for future nefarious uses
       
          Lerc wrote 1 hour 11 min ago:
          Is this an example of [1] ?
          
          If you want something done by hand,  I made kind-of the same thing in
          JavaScript ages ago. (actually, no I just looked and I made the
          emulator part in Haxe) [2] You can load programs from gists.   Save
          to local storage, maybe some other features, it's been a while.
          
          Assembler is at [3] Emulator is at [4] [Edit]
          Taking a look at the other posts,  I think that the user is using AI,
          but also sincere in their intention of learning by making things. 
          You will get people at all skill levels posting to Show HN:  So I
          don't necessarily think it's a bad thing that they are posting
          something that doesn't require a lot of skill.    Some of these
          beginner efforts are quite well received.
          
          AI moves the bar somewhat, for what a beginner can do. In an ideal
          world, they would also clearly indicate their methods to avoid
          confusion or making people feel like they have been tricked.  In
          their defence,    this too, is an attribute of beginners.  They have
          yet to learn the expectations of the community.
          
          It get's even more complicated with AI of course, because the
          expectations of the community on this are rather in flux  right now. 
          To an extent, we're all beginners when it comes to what can be made
          with AI, how to use it,  and how to present it.
          
  HTML    [1]: https://xkcd.com/810/
  HTML    [2]: https://k8.fingswotidun.com/static/ide/?gist=ad96329670965dc...
  HTML    [3]: https://github.com/Lerc/AvrAsm
  HTML    [4]: https://github.com/Lerc/kwak-8
       
            noobermin wrote 1 hour 0 min ago:
            To be clear, my main issue, if any, is the misleading headline.
            People have posted Show HN things they've used AI to help build
            (partially or completely). However, saying this is from scratch if
            it isn't is straight up lying. Moreover, the fact that this is on
            the front page is likely due that claim, so the reality of it is
            important context for readers, I imagine.
       
              Lerc wrote 42 min ago:
              It seems this was posted while I was editing my comment.  
              Essentially I agree, but feel like you have to make allowances
              for beginners in both coding and in how they conform to community
              expectations.
              
              I can see how someone using AI would consider something made from
              scratch differently.  Similarly, in the past using a batteries
              included language wouldn't have counted as from scratch to
              someone who had to write most of their support code themselves.  
              Go back further and you'll probably see people considering the
              idea of using a compiler written by someone else as not from
              scratch.
              
              Unless you want to go full NAND to Tetris, the notion of
              from-scratch is contextual.  Maybe it's shifting under our feet.
       
          edu wrote 1 hour 27 min ago:
          Agree, I was checking the code and the first thing that I notice were
          the extremely detailed doc comments even for simple methods. i.e. the
          memory[0] class.
          
          0.
          
  HTML    [1]: https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/memory....
       
        msarnoff wrote 1 hour 42 min ago:
        Instruction set looks very similar to the AVR, which is one of my
        favorites. Very cool!
       
          Lerc wrote 1 hour 38 min ago:
           [1] says
          
          >A simplified AVR-like 8-bit CPU simulator.
          
          >This module provides a lightweight CPU model inspired by the ATmega
          family.
          
  HTML    [1]: https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/cpu.py
       
       
   DIR <- back to front page