chess 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/ext/common.c CHANGED
@@ -36,14 +36,20 @@ square_to_coord (int square)
36
36
  }
37
37
 
38
38
  char*
39
- ft_to_full_move (int from, int to)
39
+ ft_to_full_move (int from, int to, char promote_in)
40
40
  {
41
- char *s = (char *) malloc (5);
41
+ char *s = (char *) malloc (7);
42
42
  s[0] = square_to_file (from);
43
43
  s[1] = square_to_rank (from);
44
44
  s[2] = square_to_file (to);
45
45
  s[3] = square_to_rank (to);
46
46
  s[4] = '\0';
47
+ if (promote_in)
48
+ {
49
+ s[4] = '=';
50
+ s[5] = promote_in;
51
+ s[6] = '\0';
52
+ }
47
53
  return s;
48
54
  }
49
55
 
data/ext/common.h CHANGED
@@ -101,7 +101,7 @@ char square_to_file (int square);
101
101
  char square_to_rank (int square);
102
102
  int coord_to_square (const char *coord);
103
103
  char* square_to_coord (int square);
104
- char* ft_to_full_move (int from, int to);
104
+ char* ft_to_full_move (int from, int to, char promote_in);
105
105
  char* result_to_s (unsigned short int r);
106
106
  char* castling_to_s (short int castling);
107
107
  char* en_passant_to_s (short int en_passant);
data/ext/game.c CHANGED
@@ -101,7 +101,7 @@ apply_move (Game *g, int from, int to, char promote_in)
101
101
  new_board->halfmove_clock++;
102
102
  g->boards[g->current] = new_board;
103
103
  g->moves[g->current] = move_done;
104
- g->full_moves[g->current] = ft_to_full_move (from, to);
104
+ g->full_moves[g->current] = ft_to_full_move (from, to, promote_in);
105
105
  g->current++;
106
106
  // Test check or checkmate of opponent king
107
107
  if (king_in_check (new_board, new_board->active_color))
data/lib/chess/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # The Chess library module.
2
2
  module Chess
3
3
  # The library version.
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-13 00:00:00.000000000 Z
12
+ date: 2012-10-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A fast chess library that use bitboards to play chess with Ruby.
15
15
  email: