Addsy

ai_snake.cpp

Apr 13th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include "ai_snake.hpp"
  2. #include <cstdlib>
  3.  
  4. // AI Snake Implementation
  5. //
  6. void AISnake::move()
  7. {
  8.     static const Direction directions[] = {
  9.         Direction::North, Direction::East, Direction::South, Direction::West
  10.     };
  11.  
  12.     if((rand() % 1000) > 750) {
  13.         changeDirection(directions[rand() % 4]);
  14.     }
  15.  
  16.     Snake::move();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment