Wii Fit data format? [closed] - wii

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So the boss just came buy to tell me he's buying a Wii + Wii Fit for the office. At first I'm thinking this is awesome, we're getting a Wii. But, we're a pretty fit group, why do we need the Wii Fit too? Of course, I opened my stupid mouth to ask that very question when I should have been basking in the glory of the moment. sigh...the work never ends...
Apparently the Wii Fit saves some sort of data to an SD card and he wants to know if we can access that data. A quick search yielded nearly nothing, except a note that the data is stored as a text file, but in Japanese. The boss is still out shopping so I can't yet see for myself.
Has anyone tried to get at the Wii Fit data? Any luck?

It is possible to decode the WiiFit save data.
Once the WiiFit savedata is stored to a SD card it will be named private\wii\title\RFNP\data.bin (for pal) or private\wii\title\RFNN\data.bin (for NTSC)
This is a standardized Wii format that all games use and it is described at http://wiibrew.org/wiki/Savegame_Files
Once you have decrypted the header and data area with he keys from http://hackmii.com/2008/04/keys-keys-keys/ you will find that data.bin contain the files:
RPFitCap.dat
RPHealth.dat
RPWiiFit.dat
These files are unencrypted, but I have not analyzed their content more then just to be able to extract weight and bmi data for my own Mii.
I have a really dirty vb6 class that produces a CSV file with dates and weight but its faaaaaar away from any kind of release.
Heres some of my extracted data:
15.11.2008 13:18:00;92
16.11.2008 15:30:00;91,1
17.11.2008 19:02:00;91,3
18.11.2008 08:23:00;90,8
19.11.2008 07:20:00;90,5
20.11.2008 09:34:00;90,5
21.11.2008 09:32:00;91,1
22.11.2008 09:11:00;91,3
23.11.2008 10:25:00;91,6
24.11.2008 10:36:00;91,2
25.11.2008 10:37:00;91,4
26.11.2008 13:40:00;90,8
27.11.2008 10:45:00;91,2
28.11.2008 11:32:00;91,4
29.11.2008 13:09:00;91
30.11.2008 13:18:00;90
01.12.2008 12:38:00;90,1
02.12.2008 13:16:00;91,2
03.12.2008 10:34:00;91,2
04.12.2008 12:06:00;91
05.12.2008 13:05:00;91,2
06.12.2008 16:28:00;90,3
07.12.2008 14:03:00;90,9
08.12.2008 12:38:00;91,3
09.12.2008 14:18:00;90,4
10.12.2008 13:43:00;90,5
11.12.2008 13:36:00;90,5
12.12.2008 14:15:00;90,3
13.12.2008 14:17:00;89,9
14.12.2008 10:42:00;90
./Al

I was able to use this info to create a table of where the data is stored in the Wii Fit savegame files.
There is more detail in the following blog post: http://jansenprice.com/blog?id=9-Extracting-Data-from-Wii-Fit-Plus-Savegame-Files
File FitPlus0.dat
-----------------
Byte Offset | Length | Description
-----------------------------------
0x0 | 8 | RPHE0000 (header)
0x8 | 22 | Name of Mii
0x1E | 1 | Unknown
0x1F | 1 | Height (in cm)
0x20 | 4 | Date of birth (stored in BCD: e.g. 1980 0228)
0x24 | | Unknown
0x95 | | Dates with data (rowlen=10)
0x35CF | | Start of some other section (unknown)
0x38A1 | | Body Test measurement data section (rowlen=21)
+0 | 4 | Date (in bitfield format)
+4 | 2 | Weight (in kg * 10)
+6 | 2 | BMI (* 100)
+8 | 2 | Balance percent (* 10)
+10 | 2 | simple value 4 ??
+12 | 1 | extended 1 ??
+13 | 1 | extended 2 ??
+14 | 1 | extended 3 ??
+15 | 1 | extended 4 ??
+16 | 2 | extended 5 ??
+18 | 1 | extended 6 ??
+19 | 1 | extended 7 ??
0x9288 | 1 | Last byte of profile

Related

Counting 15's in Cribbage Hand

Background
This is a followup question to my previous finding a straight in a cribbage hand question and Counting Pairs in Cribbage Hand
Objective
Count the number of ways cards can be combined to a total of 15, then score 2 points for each pair. Ace worth 1, and J,Q,K are worth 10.
What I have Tried
So my first poke at a solution required 26 different formulas. Basically I checked each possible way to combine cards to see if the total was 15. 1 way to add 5 cards, 5 ways to add 4 cards, 10 ways to add 3 cards, and 10 ways to add 2 cards. I thought I had this licked until I realized I was only looking at combinations, I had not considered the fact that I had to cap the value of cards 11, 12, and 13 to 10. I initially tried an array formula something along the lines of:
MIN(MOD(B1:F1-1,13)+1,10)
But the problem with this is that MIN takes the minimum value of all results not the individual results compared to 10.
I then tried it with an IF function, which worked, but involved the use of CSE formula even wehen being used with SUMPRODUCT which is something I try to avoid when I can
IF(MOD(B1:F1-1,13)+1<11,MOD(B1:F1-1,13)+1,10)
Then I stumble on an answer to a question in code golf which I modified to lead me to this formula, which I kind of like for some strange reason, but its a bit long in repetitive use:
--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2)
My current working formulas are:
5 card check
=(SUMPRODUCT(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2))=15)*2
4 card checks
=(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,3,4}))=15)*2
=(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,3,5}))=15)*2
=(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,2,4,5}))=15)*2
=(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{1,3,4,5}))=15)*2
=(SUM(AGGREGATE(15,6,--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2),{2,3,4,5}))=15)*2
3 card checks
same as 4 card checks using all combinations for 3 cards in the {1,2,3}.
There are 10 different combinations, so 10 different formulas.
The 2 card check was based on the solution by Tom in Counting Pairs in Cribbage Hand and all two cards are checked with a single formula. (yes it is CSE)
2 card check
{=SUM(--(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2)+TRANSPOSE(--MID("01020304050607080910101010",1+(MOD(B1:F1-1,13)*2),2))=15))}
Question
Can the 3 and 4 card combination sum check be brought into a single formula similar to the 2 card check?
Is there a better way to convert cards 11,12,13 to a value of 10?
Sample Data
| B | C | D | E | F | POINTS
+----+----+----+----+----+
| 1 | 2 | 3 | 17 | 31 | <= 2 (all 5 add to 15)
| 1 | 2 | 3 | 17 | 32 | <= 2 (Last 4 add to 15)
| 11 | 18 | 31 | 44 | 5 | <= 16 ( 4x(J+5), 4X(5+5+5) )
| 6 | 7 | 8 | 9 | 52 | <= 4 (6+9, 7+8)
| 1 | 3 | 7 | 8 | 52 | <= 2 (7+8)
| 2 | 3 | 7 | 9 | 52 | <= 2 (2+3+K)
| 2 | 4 | 6 | 23 | 52 | <= 0 (nothing add to 15)
Excel Version
Excel 2013
For 5:
=(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2
For 4:
=SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$5),{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}),ROW($1:$4)^0)=15))*2
For 3
=SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$10),{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}),ROW($1:$3)^0)=15))*2
For 2:
SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15))
All together:
=(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2+
SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$5),{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}),ROW($1:$4)^0)=15))*2+
SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,ROW($1:$10),{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}),ROW($1:$3)^0)=15))*2+
SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15))
For older versions we need to "trick" INDEX into accepting the arrays as Row and Column References:
We do that by using N(IF({1},[thearray]))
=(SUMPRODUCT(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))=15)*2+
SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,N(IF({1},ROW($1:$5))),N(IF({1},{1,2,3,4;1,2,3,5;1,2,4,5;1,3,4,5;2,3,4,5}))),ROW($1:$4)^0)=15))*2+
SUMPRODUCT(--(MMULT(INDEX(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)*ROW($1:$10)^0,N(IF({1},ROW($1:$10))),N(IF({1},{1,2,3;1,2,4;1,2,5;1,3,4;1,3,5;1,4,5;2,3,4;2,3,5;2,4,5;3,4,5}))),ROW($1:$3)^0)=15))*2+
SUMPRODUCT(--((CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10))+(TRANSPOSE(CHOOSE(MOD(A1:E1-1,13)+1,1,2,3,4,5,6,7,8,9,10,10,10,10)))=15))
This is a CSE That must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Problem creating a new data Type in Haskell [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to create a new data type in Haskell that has basically the same elements has the Int type with some more. I made it like this:
data Novo = -2147483648|-2147483647|...|-1|0|1|2|...|2147483647|(|+|)|(|*|) deriving (Show)
I know this is pseudocode but how do i write it then?
And when I try to compilate this the gchi gives me this error:
parse error on input ‘-’
refering to the 13 character in this line which is the first - can you help me here? Why is it giving me this error? How do i solve this?
A data constructor must be either a valid identifier starting with a capital letter, or a sequence of symbols starting with a : .
Your attempt has the following problems:
Numeric literals like -2147483648 are not valid constructors.
You cannot specify a range of constructors with .... An example like data Fourbit = -16 | ... | -1 | 0 | 1 | ... 15, is pseudocode for an explicit listing of every intended literal:
data Fourbit = -16 | -15 | -14 | -13 | -12 | -11 | -10 | -9 |
-8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
which is also pseudocode, because the literals are not valid data constructors.
Your strings (|+|) and (|*|) are also invalid names for data constructors. They don't begin with a :, and they contain parentheses.
If you really wanted to pursue this route, you need to be prepared to list ~4 billion constructors, using names like NovoNeg2147483648, Novo2147483648, NovoPlus, and NovoMult, for example.
Constructor names must start with a capital letter or :. Digits or other symbols are not allowed. Some numeric predefined types like Int behave "as if" they were defined as you show above, but that's pseudo-syntax, not actual valid Haskell.
Try instead some variant of
data Novo = PlainInt Int | Additional1 | Additional2 deriving Show

Best technique to convert to panel data

I have some returns data on 1000+ firms that I want to convert into panel form.
From my understanding, it is neither truly wide nor long form (at least from the examples I've seen).
I have attached an example of the original data set and what I want it to look like. Is there a way to achieve this? I am intermediate with Excel/VBA, and new to SAS/Stata but can use them and self-teach myself.
Consider this example using reshape in Stata:
clear *
input float(date FIRM_A FIRM_B FIRM_C FIRM_D)
1 .14304407 .8583148 .3699433 .7310092
2 .34405795 .9531917 .6376472 .2895169
3 .04766626 .6588161 .6988417 .5564945
4 .21615694 .18380463 .4781089 .3058527
5 .709911 .85116 .14080866 .10687433
6 .3805699 .070911616 .55129284 .8039169
7 .1680727 .7267236 .1779183 .51454383
8 .3610604 .1578059 .15383714 .9001798
9 .7081585 .9755411 .28951603 .20034006
10 .27780765 .8351805 .04982195 .3929535
end
reshape long FIRM_, i(date) j(Firm_ID) string
rename FIRM_ return
replace Firm_ID = "Firm " + Firm_ID
list in 1/8, sepby(date)
+---------------------------+
| date Firm_ID return |
|---------------------------|
1. | 1 Firm A .1430441 |
2. | 1 Firm B .8583148 |
3. | 1 Firm C .3699433 |
4. | 1 Firm D .7310092 |
|---------------------------|
5. | 2 Firm A .3440579 |
6. | 2 Firm B .9531917 |
7. | 2 Firm C .6376472 |
8. | 2 Firm D .2895169 |
+---------------------------+
see help reshape for more on the topic.
This can be done very easily with proc transpose in SAS. All you will need to add is a column name for column A. This will be your by variable so that the following variables will be transposed along each specific date. Other than that just make sure your data is sorted by the date column. The code would look similar to this:
proc sort data=have;
by date;
run;
proc transpose data=have out=want; /* you could add a name= or prefix= statement here to rename your variables */
by date;
run;

Two RFID readers show different identifiers

I have used two RFID readers (different vendors), which provide two different identifiers for the very same RFID tag:
Reader A shows 5BFA0746 (decimal 1543112518)
Reader B shows 4607FA5B (decimal 1174927963)
Can you explain why?
There are no similarities with the last bytes nor prefixes.
I'm not sure that I completely understand your question, but the two values are identical except for their byte-order. Hence, both readers do read the same value (possibly an ISO/IEC 14443-3 UID/anti-collsion identifier?). They just present them in reversed byte order:
+--------+--------+--------+--------+
Reader A: | Byte 0 | Byte 1 | Byte 2 | Byte 3 |
| 5B | FA | 07 | 46 |
+--------+--------+--------+--------+
Reader B: | Byte 3 | Byte 2 | Byte 1 | Byte 0 |
| 46 | 07 | FA | 5B |
+--------+--------+--------+--------+
I can think of two reasons this may be happening:
1) CRC or checksum calculations at the start vs. end of the tag ID (vendors may implement this differently) but it sounds like you've already investigated that
2) The readers are configured to read different areas of the tag. For example, are you sure you are getting the tag ID in both cases? For passive UHF RFID Tags, you might be configured to read the TID Serial # vs. EPC. For HF MiFare readers, perhaps you are reading a data bank on one reader and the ID in the other. This is a long way of saying, are you sure both of your readers are actually configured the same way?

Is this password generator biased? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Is there a flaw in this command to generate passwords?
head -c 8 /dev/random | uuencode -m - | sed -n '2s/=*$//;2p'
After generating a few passwords with it, I started to suspect that it tends to favor certain characters. Of course people are good at seeing patterns where there aren't any, so I decided to test the command on a larger sample. The results are below.
From a sample of 12,000 generated (12-digit) passwords, here are the most and least common letters and how many times they appear.
TOP 10 BOTTOM 10
Freq | Char Freq | Char
-----|----- -----|-----
2751 | I 1833 | p
2748 | Q 1831 | V
2714 | w 1825 | 1
2690 | Y 1821 | r
2673 | k 1817 | 7
2642 | o 1815 | R
2628 | g 1815 | 2
2609 | 4 1809 | u
2605 | 8 1791 | P
2592 | c 1787 | +
So for instance 'I' appears more than 1.5 times as often as '+'.
Is this statistically significant? If so, how can the command be improved?
yes, i think it is going to be biased. uuencode requires 3 bytes for each 4 output characters. since you are giving it 8 bytes the last byte is padding of some (non-random) kind and that is going to bias the 12th character (and slightly affect the 11th too).
can you try
head -c 9 /dev/random | uuencode -m -
(with 9 instead of 8) instead and post the results? that should not have the same problem.
ps also, you will no longer need to drop the "=" padding, since that's a multiple of 3.
http://en.wikipedia.org/wiki/Uuencoding
pps it certainly appears statistically significant. you expect a natural variation of sqrt(mean), which is (guessing) sqrt(2000) or about 40. so three deviations from that, +/-120, or 1880-2120 should contain 99% of letters - you are seeing something much more systematic.
ppps neat idea.
ooops i just realised -m for uuencode forces base64 rather than the uudecode algorithm, but the same idea applies.

Resources