rafaelribeiro1510 / Taiji

1st project for PLOG course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Taiji

----------------------------
|  _____       _   _  _    |
| |_   _|__ _ (_) (_)(_)   |
|   | | / _` || | | || |   |
|   | || (_| || | | || |   |
|   |_| \\__,_||_|_/ ||_|  |
|               |__/       |
----------------------------

Install

After cloning the project, open a SICStus terminal, navigate to File and hit Consult, then choose the file myTaiji.pl

Usage

Predicate that starts the game

play.

Input coordinates of white part of new piece

White Piece Row ( A - G ): C

White Piece Col ( 0 - 6 ): 2 

Input orientation of new piece

    (1)                    (2)      
  [white, black]  [black, white]    
  
    (3)                    (4)      
  [white,                [black,    
   black]                 white]    

   |: 1

Game score and board after successful play

White: 0 | Black: 0

|   | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 
| A |   |   |   |   |   |   |   | 
| B |   |   | w | b |   |   |   | 
| C |   |   |   |   |   |   |   | 
| D |   |   |   |   |   |   |   | 
| E |   |   |   |   |   |   |   | 
| F |   |   |   |   |   |   |   | 
| G |   |   |   |   |   |   |   | 
 

Rules

Taiji is a game for 2 players where the goal is to get the highest score. The score is determined by the (sum of the) size of the largest group or groups of horizontally or vertically adjacent (diagonal alignment not included) squares of the players' respective colour (light or dark). The game is constituted concretely by pieces and a 11 by 11 board, whose pre-defined occupation rate determines the number of groups to include for the end score: 3 groups for 11x11, 2 for 9x9 and only 1 group for a 7x7 game. The 60 pieces of the game are called TAJITUs: 2-square wide rectangular pieces (2x1) with both of the colours, one in one of the halves, the other on the other half.

The game starts by determining randomly the colour of the 2 players, having the first turn the player with the light colour. One at a time, players alternate to place one TAJITU on the board until the game reached a state where there is no space for another TAJITU to be placed, meaning that a player might be helping the other one to win the game because each piece has both colours. At the end, if a tie in the number of points occurs, the dark colour player wins.

About

1st project for PLOG course


Languages

Language:Prolog 91.2%Language:Raku 8.8%