Artificial intelligent assistant

Story about a cave full of hibernating rattlesnakes I remember reading a story in the nineties, probably published in the eighties or a bit earlier. It involved a sinister villain trapping some kids in a cave full of hibernating rattlesnakes. There was either a river in the cave or a flashflood at the end that enabled the kids to escape, and the villain ended up getting killed by dozens of newly-awakened rattlesnakes and getting flushed out of the cave in the river. I recall it being pretty intense for my late grade school age self, maybe targeted at Jr high age.

As I was reading @MichaelMaggs answer, I recalled that there was also a treasure involved somehow. That led me back to google and I found the book, the unsubtly titled: Trapped in Death Cave by Bill Wallace

Two boys get trapped by the bad guy in a pit in a cave full of hibernating rattlesnakes to dig up some stolen gold. A rainstorm outside causes the cave to fill with water, and the boys use the crate that the gold was in to float out of the pit and out to safety. As I recall, on their way out, they see the bad guy also floating along, dead with lots of visible rattlesnake bites. It was a fun read for a late-elementary boy. :)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7a3a9ff0efbc0f0cdbd5ceaa3b808e51