PDA

View Full Version : Position Modifier (Virtual Chess 64)


HatCat
28th June 2009, 06:52 PM
0x1D6E25
0x1D6E26
0x1D6E27
0x1D6E28
0x1D6E29
0x1D6E2A
0x1D6E2B
0x1D6E2C
0x1D6E2F
0x1D6E30
0x1D6E31
0x1D6E32
0x1D6E33
0x1D6E34
0x1D6E35
0x1D6E36
0x1D6E39
0x1D6E3A
0x1D6E3B
0x1D6E3C
0x1D6E3D
0x1D6E3E
0x1D6E3F
0x1D6E40
0x1D6E43
0x1D6E44
0x1D6E45
0x1D6E46
0x1D6E47
0x1D6E48
0x1D6E49
0x1D6E4A
0x1D6E4D
0x1D6E4E
0x1D6E4F
0x1D6E50
0x1D6E51
0x1D6E52
0x1D6E53
0x1D6E54
0x1D6E57
0x1D6E58
0x1D6E59
0x1D6E5A
0x1D6E5B
0x1D6E5C
0x1D6E5D
0x1D6E5E
0x1D6E61
0x1D6E62
0x1D6E63
0x1D6E64
0x1D6E65
0x1D6E66
0x1D6E67
0x1D6E68
0x1D6E6B
0x1D6E6C
0x1D6E6D
0x1D6E6E
0x1D6E6F
0x1D6E70
0x1D6E71
0x1D6E72

Have fun.

Comments--

Name: Position Modifier
Cheat Notes: A1B1C1D1E1F1G1H1A2B2C2D2E2F2G2H2A3B3C3D3E3F3G3H3A4 B4C4D4E4F4G4H4A5B5C5D5E5F5G5H5A6B6C6D6E6F6G6H6A7B7 C7D7E7F7G7H7A8B8C8D8E8F8G8H8
Options:
00
01 White Pawn
02 White Knight
03 White Bishop
04 White Rook
05 White Queen
06 White King
11 Black Pawn
12 Black Knight
13 Black Bishop
14 Black Rook
15 Black Queen
16 Black King

HatCat
28th June 2009, 07:34 PM
As an example, this is the code for the start position of classic games.

//In "Position Modifier\Rank 1"
801D6E25 0004
801D6E26 0002
801D6E27 0003
801D6E28 0005
801D6E29 0006
801D6E2A 0003
801D6E2B 0002
801D6E2C 0004

//In "Position Modifier\Rank 2"
801D6E2F 0001
801D6E30 0001
801D6E31 0001
801D6E32 0001
801D6E33 0001
801D6E34 0001
801D6E35 0001
801D6E36 0001

//In "Position Modifier\Rank 3"
801D6E39 0000
801D6E3A 0000
801D6E3B 0000
801D6E3C 0000
801D6E3D 0000
801D6E3E 0000
801D6E3F 0000
801D6E40 0000

//In "Position Modifier\Rank 4"
801D6E43 0000
801D6E44 0000
801D6E45 0000
801D6E46 0000
801D6E47 0000
801D6E48 0000
801D6E49 0000
801D6E4A 0000

//In "Position Modifier\Rank 5"
801D6E4D 0000
801D6E4E 0000
801D6E4F 0000
801D6E50 0000
801D6E51 0000
801D6E52 0000
801D6E53 0000
801D6E54 0000

//In "Position Modifier\Rank 6"
801D6E57 0000
801D6E58 0000
801D6E59 0000
801D6E5A 0000
801D6E5B 0000
801D6E5C 0000
801D6E5D 0000
801D6E5E 0000

//In "Position Modifier\Rank 7"
801D6E61 0011
801D6E62 0011
801D6E63 0011
801D6E64 0011
801D6E65 0011
801D6E66 0011
801D6E67 0011
801D6E68 0011

//In "Position Modifier\Rank 8"
801D6E6B 0014
801D6E6C 0012
801D6E6D 0013
801D6E6E 0015
801D6E6F 0016
801D6E70 0013
801D6E71 0012
801D6E72 0014But if you don't disable the code after updating the position and before making moves you could start seeing more than one King on the chessboard...better disable the code immediately after activation--just a quick check and un-check.

How I Made This Code
If you dump the memory pak saves of chess positions to an A64 file you can also edit the position. At some point in the file, you will see this trend, and two full bytes valued at 0xFF will separate each rank.
By looking for patterns, I was able to write the reference table for pieces and their values for both colors. By searching memory by piece value in conjunction with experimenting on the board squares, I was able to immediately eliminate search results down to eight addresses. Seven of these were buffer excesses.

Why Use This Code
In the internal game there is a "Setup Position" modifier. The game disables the following with this feature.


Both colors are limited to (16 - pawns) pieces maximally.
Both colors are limited to 8 pawns maximally.
Pawns cannot be on ranks one or eight.
You cannot add kings.
You cannot remove kings.
Kings cannot be adjacent.
Both kings cannot be in check at the same time.
If one King is in check, it must be that side's turn to move.
en passant properties reset (not implemented)
no castling (bug)