Giter Site home page Giter Site logo

chess-uni's Introduction

ReadMeSupportPalestine

Personal Info

  • full name [en]: Hamid Reza Bluri Kashani
  • full name [fa]: حمیدرضا بلوری کاشانی

Github Status

hamidb80

hamidb80

Crypto Wallets

BTC: 13gx8eaq52jUnD6QUVLHMtYq27G3PNYCfk

TON Coin: UQDudFA4cPEO1faYGsSGtbls0OpXdA5RWNMhyKD9akDcl0cD


chess-uni's People

Contributors

hamidb80 avatar mhd-eft avatar

Watchers

 avatar

chess-uni's Issues

chess board class

we wanna basic implementation of chess board pieces.

first of all we have and 2d array that represents the board ( ChessPieces board[8][8] ) with following rules:

  • empty cells are | 0
  • white pieces are positive integers | +
  • black pieces are negative integers |-

We number pieces like this: [ note: | x | => "absolute value of x" ]

  • | Pawn | = 1
  • | Rook | = 2
  • | Knight | = 3
  • | Bishop | = 4
  • | Queen | = 5
  • | King | = 6
enum ChessPieces {
	Empty = 0,

	WhitePawn = 1,
	WhiteRook = 2,
	WhiteKnight = 3,
	WhiteBishop = 4,
	WhiteQueen = 5,
	WhiteKing = 6,

	BlackPawn = -1,
	BlackRook = -2,
	BlackKnight = -3,
	BlackBishop = -4,
	BlackQueen = -5,
	BlackKing = -6,
};

we have a class called BoardClass:

class BoardClass {
public:
    ChessPieces board[8][8];

    vector<Point> possibleMoves( Point piecePosition   );
    ChessPieces move ( Point  lastPiecePosition, Point  newPiecePosition ) ;
};

we wanna add these functionalities:

  1. possibleMoves ( piecePosition ) :

    • it gets a piecePosition [ it's a Point that contains x and y ] [ the Point class defined in System::Drawing]
    • returns vector<Point> for possible movements of piece at piecePosition
  2. move ( lastPiecePosition, newPiecePosition ) :

    • moves the piece at lastPiecePosition to the new position newPiecePosition
    • returns removed piece as result of moving that piece [ if no piece removed as result of this move, then it should return ChessPieces.Empty ]

theming system #1

we wanna implement a feature that user can choose between:

  1. different board backgrounds
  2. different pieces colors
  3. different pieces types

database

We wanna a JSON like database with these functionalities:

class Database{
public:
    int 
        total_time, 
        reminded_time;
   ..... 
   

    void save_to_file( string path );
    void load_from_string( string str ) ;
    void load_from_file( string parh );

    json dump_json();
} ;

send email funtionality

we wanna some functionality to send email.

desired API:

void sendEmail ( string targetEmail, string message );

Undo

The very first thing about implementing undo system is to save every single users action.

something like:

  1. user1 moved the Pawn from (x1, y1) to (x2, y2) - as result the queen of user2 at (x2, y2) kicked off
  2. User2 moved King from p1 to p2 as result nothing happend
  3. User1 moved pawn from ....
  4. ...

And the when we wanna undo the actions, we simply reverse the user actions.

The basic implementation of undo system [ that I suggest ] is as follows:

class Movement {
public:

   string 
        user1_name,
        user2_name;

    Point p1, p2;  // Point is a class that contains a (x, y) - defind in System::Drawing

    ChessPiece kicked_off_piece; // remeber the ChessPiece enum defined in chessClass module 
} ;


class MovementTracker {
public:
    vector <Movement>  moves;
    
    void add ( Movement m ) ;
    Movement undo ();
} ;

Explanation:
MovementTracker's job is to store the users moves.
add method gives a new movement and add it to moves

undo method in other hand, returns the last element of moves ;

intro pages

intro pages are consists of:

  1. the page that the user chooses to be client or server

    • contains 2 buttons => one for choosing client, and one for choosing server
    • after clicking on those buttons the current window should close and corresponding window should open
  2. client login page

    • contains a text filed for username
    • contains a text filed a password [optional] and a button to login
  3. server login page

    • contains a text filed for username
    • contains a text filed a password [optional] and a button to start
  4. wait page to wait for other side

  • in 2 & 3 also there must be 3 text fields to fill host and port and email.

timer component

features:

  1. play/pause
  2. set time

desired API:

class Timer {
public:
  void setTime(int secs) ;
  void start();
  void stop();
  void reset();
};

script to create pieces with different colors

i'm actually wanna write a script to get a set of pieces pictures as PNG format, and then change the color of the that piece in the picture.

i prefer using Nim language for that but the TA doesn't know because he only see the result as PNG format 🤣

chess board compoenent #1

features:

  1. get position of clicked cell as (x, y)
  2. ability to set the color of the cell
  3. ability to set cell Chess pieces [مهره های شطرنج]

music player component

features:

  1. change song
  2. play/pause
  3. stop

desired API:

class MusicPlayer{
   
 public:
   void selecrMusic( string music_file_path );
   void play( );
   void pause( );
   void resetTime();
};

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.