QL-MAC: A Q-learning based MAC for wireless sensor networks