So I played many games online where I am winning but then lose on time. Sometimes the game is drawn (when there is no sequence of legal moves that would produce checkmate) and sometimes I lose (when there is such a sequence). The decision the website takes happens instantly. I am wondering, how do they determine whether the game is a draw or not? If they use brute force, then the decision would take longer to arrive at.
As far as I know, every chess website simply looks at the opponents material to determine if they have mating material or not. It doesn't matter even if mate is possible.
The ruleset you are referring to are the FIDE rules, and for simplicity chess websites do not use these rules because the percentage of positions where self-mate is possible is too low.
This comes from python-chess:
def is_insufficient_material(self): """Checks for a draw due to insufficient mating material.""" # Enough material to mate. if self.pawns or self.rooks or self.queens: return False # A single knight or a single bishop. if popcount(self.occupied) <= 3: return True # More than a single knight. if self.knights: return False # All bishops on the same color. if self.bishops & BB_DARK_SQUARES == 0: return True elif self.bishops & BB_LIGHT_SQUARES == 0: return True else: return False