innoviox / bredon Goto Github PK
View Code? Open in Web Editor NEWAI for the game Tak in python
Home Page: https://github.com/Innoviox/bredon
License: GNU General Public License v3.0
AI for the game Tak in python
Home Page: https://github.com/Innoviox/bredon
License: GNU General Public License v3.0
1 2 3 4
a W{F}B{F} B{F}W{F}
b W{F} W{F} W{F}
c W{F} B{F}
d B{F} B{F} B{F} B{F}
1. a1 d4
2. b2 d2
3. a2 c4
4. a3 a4
5. 1a3+ a3
6. 1a1> 1a3-
7. c1 d3
8. b3 d1
B won!
Also the return beta/-beta
fix slows it down considerably -- data coming soon.
So...new method?
If it's enhancement:
I've selected init.py for refactoring, which is a module of 361 lines of code and 12 incoming calls. Addressing this will make our codebase more maintainable and improve Better Code Hub's Separate Concerns in Modules guideline rating! 👍
Here's the gist of this guideline:
You can find more info about this guideline in Building Maintainable Software. 📖
ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the 🔲 next to them. The risk profile below the candidates signals (✅) when it's enough! 🏁
Good luck and happy coding! ✨ 💯
Input bar on view
Implement turn & player in tps algorithm
Reproduce:
a4
a3
a2
e1
Move(total=1, stone='C', col='d', row='2', moves=[], direction=None)
Error: Not enough pieces left
add self.master.turn < 2 check in VB
sum(moves) == self.nridx_first
If it's a bug:
If it's enhancement:
Excerpt from output of python3.6 main.py -w ai:3
4.283537149429321
WHITE BLACK
1 Cb2
1 2 3 4 5
a @a1 @a2 @a3 @a4 @a5
b @b1 BLACK{C}@b2 @b3 @b4 @b5
c @c1 @c2 @c3 @c4 @c5
d @d1 @d2 @d3 @d4 @d5
e @e1 @e2 @e3 @e4 @e5
3.645015001296997
WHITE BLACK
1 Cb2 Ca3
1 2 3 4 5
a @a1 @a2 WHITE{C}@a3 @a4 @a5
b @b1 BLACK{C}@b2 @b3 @b4 @b5
c @c1 @c2 @c3 @c4 @c5
d @d1 @d2 @d3 @d4 @d5
e @e1 @e2 @e3 @e4 @e5
1.839872121810913
WHITE BLACK
1 Cb2 Ca3
2 Sa2
1 2 3 4 5
a @a1 WHITE{S}@a2 WHITE{C}@a3 @a4 @a5
b @b1 BLACK{C}@b2 @b3 @b4 @b5
c @c1 @c2 @c3 @c4 @c5
d @d1 @d2 @d3 @d4 @d5
e @e1 @e2 @e3 @e4 @e5
1.8416838645935059
WHITE BLACK
1 Cb2 Ca3
2 Sa2 b1
1 2 3 4 5
a @a1 WHITE{F}@a2 WHITE{C}@a3 @a4 @a5
b BLACK{F}@b1 BLACK{C}@b2 @b3 @b4 @b5
c @c1 @c2 @c3 @c4 @c5
d @d1 @d2 @d3 @d4 @d5
e @e1 @e2 @e3 @e4 @e5
Note that in ply 2a, White makes the rather nonsensical move Sa2, which is correctly translated in the board. But by ply 2b, it's flat, which makes more sense.
Enter move: >? a1
1. a1
1 2 3 4
a W{F}
b
c
d
Enter move: >? d4
1. a1 d4
1 2 3 4
a W{F}
b
c
d B{F}
First entered moves.
1. a1 d4
2. b2
1 2 3 4
a W{F}
b W{F}
c
d B{F}
1. a1 d4
2. b2 d2
1 2 3 4
a W{F}
b W{F}
c
d B{F} B{F}
Kind of weird openers, but ok.
1. a1 d4
2. b2 d2
3. a2
1 2 3 4
a W{F} W{F}
b W{F}
c
d B{F} B{F}
1. a1 d4
2. b2 d2
3. a2 c4
1 2 3 4
a W{F} W{F}
b W{F}
c B{F}
d B{F} B{F}
Super strange attacks.
1. a1 d4
2. b2 d2
3. a2 c4
4. a3
1 2 3 4
a W{F} W{F} W{F}
b W{F}
c B{F}
d B{F} B{F}
1. a1 d4
2. b2 d2
3. a2 c4
4. a3 a4
1 2 3 4
a W{F} W{F} W{F} B{F}
b W{F}
c B{F}
d B{F} B{F}
A more normal attack-and-block.
1. a1 d4
2. b2 d2
3. a2 c4
4. a3 a4
5. b4
1 2 3 4
a W{F} W{F} W{F} B{F}
b W{F} W{F}
c B{F}
d B{F} B{F}
1. a1 d4
2. b2 d2
3. a2 c4
4. a3 a4
5. b4 d3
1 2 3 4
a W{F} W{F} W{F} B{F}
b W{F} W{F}
c B{F}
d B{F} B{F} B{F}
White re-attacks, forcing a a3-b>:a
road fork. Black's only option here is a4<
, but instead it goes for d3
, to flesh out its attack plan. But White recaptures and wins with b4+
.
What led black to this fatal mistake?
If it's a bug:
If it's enhancement:
Right now get_connections will return an unordered road.
Needs to work to get neural started
Currently Square.next and Tile.next are implemented the same. I propose a global next method, like so:
def next(obj):
if obj is a square or tile:
{default next implementation}
raise type error
Alternatively, a class "positionable" with a next method that both square and tile inherit from, but this seems a little weird.
A standard 4x4 depth a1/d4 led to this:
1. a1 d4
2. d2 b2
3. d3 Sd1
4. c3 a2
5. c4 1a1>
6. c1 Sc2
7. a4 Sb4
8. b3 1b2+
9. a1 2b3>11
10. 2c3> Sb3
11. 3d3< 1b3<
12. 1a1+ 1b1<
13. 1c3< 1a1+
14. b1 1c2+
15. b2
W won!
Notes:
Moves that move tiles don't appear to when running main.
Dependabot couldn't authenticate with https://pypi.python.org/simple/.
You can provide authentication details in your Dependabot dashboard by clicking into the account menu (in the top right) and selecting 'Config variables'.
white_types => white
black_types => black
Game(white=HUMAN, black=AI(3)) looks better i think
If it's a bug:
W, h is too verbose and useless
Capstones can be selected when the player doesn't have any, and on the first move.
Board should have a list of players
Board should have a .do_move and .undo that advances its state instead of having players act upon it
Board should generate based on its state
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.