-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kill by surronding #1
base: main
Are you sure you want to change the base?
Add kill by surronding #1
Conversation
b06c974
to
64a7761
Compare
Thanks a lot for the contribution. It is very appreciated. |
64a7761
to
c44c10a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will review the surrounding rule, and may come back with other comments.
README.md
Outdated
## Roadmap | ||
|
||
- [x] Simple AI algorithm. | ||
- [x] Undo last play is missing. | ||
- [x] implement traitors when chief is surrounded | ||
- [ ] improve IA algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'AI' instead of 'IA'.
And kindly consider starting all sentences with a capital letters here, just for completeness with other sentences in this list.
flutter/lib/models/member.dart
Outdated
return true; | ||
} | ||
visited.add(location); | ||
List<Cell> directions = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Cell.allDirections
instead.
flutter/lib/models/member.dart
Outdated
]; | ||
|
||
for (Cell direction in directions) { | ||
Cell newPosition = Cell(location.x + direction.x, location.y + direction.y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the overloaded +
operator of Cell class. So it can be:
final newPosition = location + direction;
flutter/lib/models/member.dart
Outdated
for (Cell direction in directions) { | ||
Cell newPosition = Cell(location.x + direction.x, location.y + direction.y); | ||
if (!newPosition.isValid) { | ||
continue; // Cell is off the board, considered as not surrounded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you mean "continue to examine other directions" instead of "considered as not surrounded"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed
flutter/lib/models/party.dart
Outdated
@@ -22,4 +21,6 @@ class Party { | |||
|
|||
Member? getMemberAt(Cell cell) => | |||
aliveMembers.firstWhereOrNull((m) => m.location == cell); | |||
|
|||
bool get isActive => chief.isAlive && !chief.isSurrounded() && movableMembers.isNotEmpty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer keeping isActive
property close to isLost
, as the logic is very related.
Great, thanks for the review. I updated the code in consequence |
I have reviewed the kill by surrounding rules, and played the game with your changes. I found many deviations between your implementation and the rules (based on my understanding). The following is what stated regarding killing by surrounding in the document that you have added:
So, I see the following deviations in your implementation:
|
Thank you for your review. I will apply some changes to correct it as soon as possible. |
Hello !
I saw your djambi project which I found amazing and wanted to contribute to the project.
Here is a suggestion to add the rule of the surronding of a chief.
Please let me know what you think of it.