Jump to content

Programming Challenge, Hexidecimals Involved


rglass95

Recommended Posts

OK, I'm going nuts trying to figure out this hist.dat file, which is stored in a binary format. There's going to be some math involved with this, so hopefully my fellow programmer-types can help me out with this.

bagwell.gif

This is a single record in the hist.dat file - more specifically, Jeff Bagwell's 2004 stats. Note that this is in little endian format, so take the player ID in two digit increments:

6A B8 58 F4 0

And reverse it:

0 F4 58 B8 6A

Put it all together:

0F458B86A

This is Jeff Bagwell's ID in the attrib.dat file.

The year is 07D4, or in decimal format, 2004. The team code is next, followed by a flag that states if this is a hitting or pitching stat line. The next two are giving me problems, so we'll skip those for now.

The other stats are calculated as follows:

SB = (&h001A - 2) / 4 = 6

H = &h98 = 152

RBI = &hB2 / 2 = 89

R = &hD0 / 2 = 104

HR = &h36 / 2 = 27

The at bats and games are giving me issues. For the at bats, &h3C is equal 60. Bagwell had 572 at bats in 2004, which is a difference of 512. Alright, so it's going over the limit of 255 twice . . . the question is, how does it know this?

For games, &h72 = 114. Bagwell played in 156 games in 2004. This one makes no sense to me right now.

Here is a list of every record in the hist.dat file. If I figure out how it calculates games and at bats I can easily read them in and allow editing of them. I'm going to move on and do the pitchers now - hopefully someone can figure this out.

http://www.glass4.com/MVPedit/list.txt

Link to comment
Share on other sites

more **** you already know

OK I wanted someone with more than 256 hits well that's Ichiro

4F229FE50

100000000

D407

02

81

C0

86

9200

06 HITS 6=6 256+6=262 is his hit total

79

CA

1000000000

the bold seem to be the trigger to add 256 to hit total

Link to comment
Share on other sites

Tim Salmon

he played in 60 games last season

A52460250100000000D4070081BAF004002F2E1E0400000000

F0 GAMES F0= 240

divide by 4?

Shane Halter

played in 46 games

A0CE310C0100000000D407008172B80400171A140800000000

B8=184

184/4=46

Link to comment
Share on other sites

Yeah, I think we need to compare three types of guys.

Anyone that played in 63 or less games.

Anyone that played between 64 and 127 games.

Anyone that played in 128 to 162 games.

For instance, players with 162 games have 8A (138).

I had a chart that was comparing the number of games for every player to their hex code, but I think my data is all wrong.

Link to comment
Share on other sites

GAMES

1-63

value/4

64-127

value/4+64

128-162

value/4+128

all in hex

bags

72/4=1C

1C+80 is 28 + 128 =156

162 =8A

8A/4=22

22+80=A2

A2(HEX)=162(DEC)

There are errors in EA stats BTW

took me awhile because Joe Randa did not work, but they had him down with wrong # of games

Link to comment
Share on other sites

OK, so if I just saw the hex value &h72, how would I know to add 128 to it after dividing by 4? Maybe I'm just not seeing it, I'm kinda burning myself out on these.

I have an idea about the trigger but I have not worked out in my head yet

Link to comment
Share on other sites

just throwing this out because I have to leave again it has something to do with the trigger

I have not tested many numbers but

games 1-64 when converted straight to DEC and divided by 4 they come out even

65-128 when converted straight to DEC and divided by 4 they come out with a something.25 (X.25)

129-162 when converted straight to DEC and divided by 4 they come out with something.50 (X.50)

samples

Tim Salmon is F0 he played in 60 games

F0/4=3C

3C=60(DEC)

F0=240(DEC)

240/4=60 nothing after the decimal point

Jason Larue is C9 he played in 114 games

C9/4=32

32+40=72

72(HEX)=114(DEC)

C9(HEX)=201(DEC)

201/4=50.25 .25 at the end

Bags is 72 he played in 156 games

72/4=1C

1C+80=9C

9C(HEX)=156(DEC)

72(HEX)=114(DEC)

114/4=28.5 .5 at the end

Link to comment
Share on other sites

i just saw the link and i pray to god there not using prime numbers.lol..

by the way, i havent really checked out the link tha rglass posted but just by reading the thread,

i'd like one sample line of input, and then i'd like to know what each part of the string u think represents.

my guess is that they're using a different base to calculate the decimal value and there doing it based on a multiple(right now, im assuming a multiple of 64)..but like i said, right now i still dont have the game and im not sure if i know what im talking about so how about one line of data from the file and what u have figured out so far. Give me the line in pieces. thanks.hope i can help

Link to comment
Share on other sites

The text file is the data from the file

it is strung together as a binary file, rglass took all the seperate strings and made a text file out of them

Download Kerms roster it has the hist.dat file in it

basicly games 1-63 are divisible by 4

65-127 is divisible by 4 if you subtract 1 from the value first

128-162 is divisible by 4 if you add or subtract 2 from the value first

if it is divisible 4 four do nothing

if you have to substact 1 to make it divisible by 4 add 64 to total

if you have to substact/add 2 to make it divisible by 4 add 128 to total

Link to comment
Share on other sites

i'd like one sample line of input, and then i'd like to know what each part of the string u think represents.

fuzzy, the image I posted on the first post of this thread is exactly that.

I think krawhitham is on the right track. I dissected the pitching lines today, and the only issue there is wins and losses, probably the same thing we are seeing here.

Link to comment
Share on other sites

career.jpg

Here is a screenshot, the value in the hits field is the hex code for both at bats and hits. Definately a pattern there. Unfortunantly the game only shows you the previous 15 seasons, as I created this record with 256 previous seasons. :twisted:

Link to comment
Share on other sites

So what did you end up putting into the hits field to get these numbers? I'm curious because I'm trying to decode the PS2 roster save file with intentions of making an editor for PS2 rosters. The PS2 roster data is extremely compressed and so far, all I've been able to identify is Photo/Roster ID# and birthdate data. I'm thinking that they used this same method for most of the PS2 data. Thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...