Skip to content
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

Modify evaluation of edges #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions game/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ def evaluation(self, current_state, player_to_check):
(state[63] == opponent)
corners_eval = corners_player + corners_opponent

edges_player = len([x for x in state if state == player and (state % 8 == 0 or state % 8 == 8)]) / (
WIDTH * HEIGHT)
edges_opponent = -1 * len([x for x in state if state == opponent and (state % 8 == 0 or state % 8 == 8)]) / (
WIDTH * HEIGHT)
edges_eval = edges_player + edges_opponent
edges_player = len([p for i, p in enumerate(state) if p == player and (i%8==0 or i%8==7 or i/8==0 or i/8==7)])
edges_opponent = len([p for i, p in enumerate(state) if p == opponent and (i%8==0 or i%8==7 or i/8==0 or i/8==7)])
edges_eval = edges_player - edges_opponent

eval = count_eval * 2 + corners_eval * 1.5 + edges_eval * 1.2

Expand Down