]> git.scottworley.com Git - slidingtile/commitdiff
successors is const
authorScott Worley <scottworley@scottworley.com>
Sat, 9 Jan 2016 10:42:11 +0000 (02:42 -0800)
committerScott Worley <scottworley@scottworley.com>
Sat, 9 Jan 2016 10:42:11 +0000 (02:42 -0800)
sliding_tile_lib.cc
sliding_tile_lib.h

index e4f2f12723591ac320a56813eb8b3b306eaace30..5284dab95e4d4f707310f4fab44f996fdd8f56f8 100644 (file)
@@ -133,7 +133,7 @@ int Board::distance(const InvertedBoard& invo) const {
   return dist;
 }
 
-std::vector<Step*> Step::successors(std::shared_ptr<Step> shared_this) {
+std::vector<Step*> Step::successors(std::shared_ptr<Step> shared_this) const {
   std::vector<Step*> suc;
   signed char hole_pos = board.hole();
   for (int i = 0; adjacent[hole_pos][i] > 0; i++) {
index 772817ea5ea57d84d28aafa6f6d0a9d607e39187..1b56da4c80a7e4fbc18947abc4a6f193c0eb057c 100644 (file)
@@ -30,7 +30,7 @@ std::ostream& operator<<(std::ostream& os, const Board& board);
 struct Step {
   Board board;
   std::shared_ptr<Step> prev;
-  std::vector<Step*> successors(std::shared_ptr<Step> shared_this);
+  std::vector<Step*> successors(std::shared_ptr<Step> shared_this) const;
   static signed char adjacent[BOARD_SIZE][5];
 };
 std::ostream& operator<<(std::ostream& os, const Step& step);