fork download
  1. struct player_mover {
  2. public:
  3. void read(key); // pushes a new direction
  4. void map(key, sob::cell); // maps a key to a direction
  5. sob::cell operator()(const sob::cell& pos) {
  6. if (direction_queue.empty()) return pos;
  7.  
  8. auto new_pos = pos + direction_queue.front();
  9. direction_queue.pop_front();
  10. return new_pos;
  11. }
  12. private:
  13. std::deque<sob::cell> direction_queue;
  14. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:12: error: ‘key’ has not been declared
  void read(key); // pushes a new direction
            ^
prog.cpp:4:11: error: ‘key’ has not been declared
  void map(key, sob::cell); // maps a key to a direction
           ^
prog.cpp:4:16: error: ‘sob’ has not been declared
  void map(key, sob::cell); // maps a key to a direction
                ^
prog.cpp:5:2: error: ‘sob’ does not name a type
  sob::cell operator()(const sob::cell& pos) {
  ^
prog.cpp:13:2: error: ‘deque’ in namespace ‘std’ does not name a type
  std::deque<sob::cell> direction_queue;
  ^
stdout
Standard output is empty