Giter Site home page Giter Site logo

wadaboa / tablut Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 347 KB

Tablut board game player for Fundamentals of Artificial Intelligence class at UNIBO

License: MIT License

Python 98.44% Shell 0.94% PowerShell 0.62%
artificial-intelligence competition board-game tablut unibo ai

tablut's Introduction

Tablut board game

Software for the Tablut Students Competition at University of Bologna.
The Server side is written in Java 8, so you'll need JDK 8 to use it.
The Client side is written in Python 3, so you'll need to install it properly on your system.

Installation

To install the client/server softwares and their dependencies follow the guidelines specified in the sub-directories Client and Server.

Server execution

If you have ANT installed on your system, just run:

  1. cd inside Server/Tablut/
  2. ant clean
  3. ant compile
  4. ant server

Client execution

Run the following commands:

  1. cd into Client/
  2. Run ./CalbiFalai.sh, also giving the mandatory parameters

Server response examples

Board state

{
	"board": [
		["EMPTY", "EMPTY", "EMPTY", "BLACK", "BLACK", "BLACK", "EMPTY", "EMPTY", "EMPTY"], 
		["EMPTY", "EMPTY", "EMPTY", "EMPTY", "BLACK", "EMPTY", "EMPTY", "EMPTY", "EMPTY"], 
		["EMPTY", "EMPTY", "EMPTY", "EMPTY", "WHITE", "EMPTY", "EMPTY", "EMPTY", "EMPTY"], 
		["BLACK", "EMPTY", "EMPTY", "EMPTY", "WHITE", "EMPTY", "EMPTY", "EMPTY", "BLACK"], 
		["BLACK", "BLACK", "WHITE", "WHITE", "KING", "WHITE", "WHITE", "BLACK", "BLACK"], 
		["BLACK", "EMPTY", "EMPTY", "EMPTY", "WHITE", "EMPTY", "EMPTY", "EMPTY", "BLACK"], 
		["EMPTY", "EMPTY", "EMPTY", "EMPTY", "WHITE", "EMPTY", "EMPTY", "EMPTY", "EMPTY"], 
		["EMPTY", "EMPTY", "EMPTY", "EMPTY", "BLACK", "EMPTY", "EMPTY", "EMPTY", "EMPTY"], 
		["EMPTY", "EMPTY", "EMPTY", "BLACK", "BLACK", "BLACK", "EMPTY", "EMPTY", "EMPTY"]
	], 
	"turn": "WHITE"
}

tablut's People

Contributors

leocalbi avatar wadaboa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tablut's Issues

None TablutBoardPosition

Traceback (most recent call last):
File "c:\python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "c:\python37\lib\threading.py", line 870, in run
self._target(*self._args, **self.kwargs)
File "c:\python37\lib\site-packages\tablut_player_main
.py", line 98, in play
my_move = get_move(game, game_state, conf.MOVE_TIMEOUT-10)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 95, in get_move
move = alphabeta_player(game, state, timeout, max_depth)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 110, in alphabeta_player
return alphabeta_cutoff_search(state, game, timeout, alphabeta_cutoff_test, heuristic, max_depth)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 79, in alphabeta_cutoff_search
v, total = max_value(game.result(state, a), best_score, beta, 1)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 43, in max_value
alpha, beta, depth + 1)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 60, in min_value
alpha, beta, depth + 1)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 43, in max_value
alpha, beta, depth + 1)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 55, in min_value
return eval_fn(game.turn, state, gutils.other_player(state.to_move)), 1
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 124, in heuristic
return black_heuristic(turn, state)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 133, in black_heuristic
value -= king_moves_to_goals_count(state.pawns)
File "c:\python37\lib\site-packages\tablut_player\strategy.py", line 181, in king_moves_to_goals_count
distance = TablutBoard.simulate_distance(pawns, king, goal)
File "c:\python37\lib\site-packages\tablut_player\board.py", line 274, in simulate_distance
moves = cls.legal_moves(pawns, initial_coords)
File "c:\python37\lib\site-packages\tablut_player\board.py", line 84, in legal_moves
cls._possible_positions(pawn_coords)
File "c:\python37\lib\site-packages\tablut_player\board.py", line 95, in _possible_positions
TablutBoardPosition(row=i, col=pawn_coords.col)
AttributeError: 'NoneType' object has no attribute 'col'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.