Initial commit

This commit is contained in:
Alexander Kobjolke 2025-03-13 22:36:51 +01:00
commit 4f4397b3e1
48 changed files with 2002 additions and 0 deletions

View file

@ -0,0 +1,38 @@
//
// Created by JoachimWagner on 10.03.2025.
//
#pragma once
#include <vector>
#include "../AbstractGame.h"
#include "../../io/Writer.h"
#include "../player/Player.h"
namespace atlas::game::nimgame {
class NimGame: public AbstractGame<int, int> {
public:
explicit NimGame(io::Writer &writer) : AbstractGame(writer) {
setBoard(23);
}
protected:
auto updateBoard()-> void override{ setBoard(getBoard()- getTurn());}
auto isGameOver()->bool override{ // Operation
return getBoard() < 1 || getPlayers().empty();
}
[[nodiscard]] auto isTurnValid() const -> bool override { return getTurn() >= 1 && getTurn() <= 3; }
};
}