software-challenge / backend

Server, Client und Spiel-Plugins der Software-Challenge Germany
https://www.software-challenge.de
11 stars 10 forks source link

MoveMistakes don't tell who violated #320

Closed anarchuser closed 3 years ago

anarchuser commented 3 years ago

It could have a method taking a Team or Color and return a message saying who violated how, i.e.:

MoveMistake.WRONG_COLOR.toString() shouldBe "Die Farbe des Zuges ist nicht an der Reihe"
MoveMistake.WRONG_COLOR.toString(Color.RED) shouldBe "Farbe Rot ist aktuell nicht an der Reihe"

Related to https://github.com/CAU-Kiel-Tech-Inf/gui/issues/7

anarchuser commented 3 years ago

Actually, there is probably no need for the first method; thus, it makes more sense to give MoveMistakes the color as property and change the first method into documentation

xeruf commented 3 years ago

I would like to prevent coupling code that doesn't have to be coupled, i.e. not add the color as property.

anarchuser commented 3 years ago

seems reasonable. I'm going to rework this anyways, though - It probably makes sense to construct InvalidMoveExceptions with MoveMistakes and Moves (the latter already contains information on the color, anyways)