@@ -7960,43 +7960,8 @@ bool __fastcall XgIsAnyThreadTerminated(void) noexcept
7960
7960
// パターンの統計情報を表示。
7961
7961
void XgShowPatInfo (HWND hwndInfo)
7962
7962
{
7963
- std::wstring text;
7964
-
7965
- // 使用文字の頻度分布。
7966
- {
7967
- std::map<WCHAR, DWORD> ch2num;
7968
- {
7969
- const XG_Board *xw = (xg_bSolved ? &xg_solution : &xg_xword);
7970
- for (int i = 0 ; i < xg_nRows; i++) {
7971
- for (int j = 0 ; j < xg_nCols; j++) {
7972
- auto ch = xw->GetAt (i, j);
7973
- ch2num[ch] += 1 ;
7974
- }
7975
- }
7976
- }
7977
- std::vector<std::pair<DWORD, DWORD>> pairs;
7978
- for (auto & pair : ch2num) {
7979
- pairs.push_back (pair);
7980
- }
7981
- std::sort (pairs.begin (), pairs.end (), [](auto & a, auto & b){
7982
- return a.second > b.second ;
7983
- });
7984
- text += L" \r\n " ;
7985
- text += L" [[ " ;
7986
- text += XgLoadStringDx1 (IDS_CHARUSAGEDIST);
7987
- text += L" ]]" ;
7988
- text += L" \r\n " ;
7989
- for (auto & pair : pairs) {
7990
- text += (WCHAR)0x3010 ; // 【
7991
- text += pair.first ;
7992
- text += (WCHAR)0x3011 ; // 】
7993
- text += L" : " ;
7994
- text += std::to_wstring (pair.second );
7995
- text += L" \r\n " ;
7996
- }
7997
- }
7963
+ std::wstring text; // この関数では、この変数にテキストを追加していく。
7998
7964
7999
- // 単語の長さの頻度分布。
8000
7965
if (xg_bSolved) {
8001
7966
std::map<WCHAR, DWORD> len2num;
8002
7967
std::vector<XG_WordData> dict = XgCreateMiniDict ();
@@ -8010,6 +7975,14 @@ void XgShowPatInfo(HWND hwndInfo)
8010
7975
std::sort (pairs.begin (), pairs.end (), [](auto & a, auto & b){
8011
7976
return a.second > b.second ;
8012
7977
});
7978
+ // 使用単語数。
7979
+ text += L" \r\n " ;
7980
+ text += L" [[ " ;
7981
+ text += XgLoadStringDx1 (IDS_WORDCOUNT);
7982
+ text += L" ]] : " ;
7983
+ text += std::to_wstring (dict.size ());
7984
+ text += L" \r\n " ;
7985
+ // 単語の長さの頻度分布。
8013
7986
text += L" \r\n " ;
8014
7987
text += L" [[ " ;
8015
7988
text += XgLoadStringDx1 (IDS_WORDLENDIST);
@@ -8057,7 +8030,113 @@ void XgShowPatInfo(HWND hwndInfo)
8057
8030
text += L" \r\n " ;
8058
8031
}
8059
8032
8060
- // パターンの頻度分布。
8033
+ {
8034
+ size_t count = xg_dict_1.size ();
8035
+ size_t sum = 0 , min = 999999 , max = 0 ;
8036
+ for (auto & data : xg_dict_1) {
8037
+ auto len = data.m_word .size ();
8038
+ if (min > len)
8039
+ min = len;
8040
+ if (max < len)
8041
+ max = len;
8042
+ sum += data.m_word .size ();
8043
+ }
8044
+ // 辞書中の単語の個数。
8045
+ text += L" \r\n " ;
8046
+ text += L" [[ " ;
8047
+ text += XgLoadStringDx1 (IDS_DICTWORDCOUNT);
8048
+ text += L" ]]" ;
8049
+ text += L" : " ;
8050
+ text += std::to_wstring (count);
8051
+ // 辞書中の単語の長さ。
8052
+ text += L" \r\n " ;
8053
+ text += L" [[ " ;
8054
+ text += XgLoadStringDx1 (IDS_DICTWORDLENAVG); // 平均値。
8055
+ text += L" ]]" ;
8056
+ text += L" : " ;
8057
+ text += std::to_wstring (sum / (double )count);
8058
+ text += L" \r\n " ;
8059
+ text += L" [[ " ;
8060
+ text += XgLoadStringDx1 (IDS_DICTWORDLENMIN); // 最小値。
8061
+ text += L" ]]" ;
8062
+ text += L" : " ;
8063
+ text += std::to_wstring (min);
8064
+ text += L" \r\n " ;
8065
+ text += L" [[ " ;
8066
+ text += XgLoadStringDx1 (IDS_DICTWORDLENMAX); // 最大値。
8067
+ text += L" ]]" ;
8068
+ text += L" : " ;
8069
+ text += std::to_wstring (max);
8070
+ text += L" \r\n " ;
8071
+ }
8072
+
8073
+ // 辞書中のヒントの長さ。
8074
+ {
8075
+ size_t count = xg_dict_1.size ();
8076
+ size_t sum = 0 , min = 999999 , max = 0 ;
8077
+ for (auto & data : xg_dict_1) {
8078
+ auto len = data.m_hint .size ();
8079
+ if (min > len)
8080
+ min = len;
8081
+ if (max < len)
8082
+ max = len;
8083
+ sum += data.m_hint .size ();
8084
+ }
8085
+ text += L" \r\n " ;
8086
+ text += L" [[ " ;
8087
+ text += XgLoadStringDx1 (IDS_DICTHINTLENAVG); // 平均値。
8088
+ text += L" ]]" ;
8089
+ text += L" : " ;
8090
+ text += std::to_wstring (sum / (double )count);
8091
+ text += L" \r\n " ;
8092
+ text += L" [[ " ;
8093
+ text += XgLoadStringDx1 (IDS_DICTHINTLENMIN); // 最小値。
8094
+ text += L" ]]" ;
8095
+ text += L" : " ;
8096
+ text += std::to_wstring (min);
8097
+ text += L" \r\n " ;
8098
+ text += L" [[ " ;
8099
+ text += XgLoadStringDx1 (IDS_DICTHINTLENMAX); // 最大値。
8100
+ text += L" ]]" ;
8101
+ text += L" : " ;
8102
+ text += std::to_wstring (max);
8103
+ text += L" \r\n " ;
8104
+ }
8105
+
8106
+ // 使用文字の頻度分布。
8107
+ {
8108
+ std::map<WCHAR, DWORD> ch2num;
8109
+ {
8110
+ const XG_Board *xw = (xg_bSolved ? &xg_solution : &xg_xword);
8111
+ for (int i = 0 ; i < xg_nRows; i++) {
8112
+ for (int j = 0 ; j < xg_nCols; j++) {
8113
+ auto ch = xw->GetAt (i, j);
8114
+ ch2num[ch] += 1 ;
8115
+ }
8116
+ }
8117
+ }
8118
+ std::vector<std::pair<DWORD, DWORD>> pairs;
8119
+ for (auto & pair : ch2num) {
8120
+ pairs.push_back (pair);
8121
+ }
8122
+ std::sort (pairs.begin (), pairs.end (), [](auto & a, auto & b){
8123
+ return a.second > b.second ;
8124
+ });
8125
+ text += L" \r\n " ;
8126
+ text += L" [[ " ;
8127
+ text += XgLoadStringDx1 (IDS_CHARUSAGEDIST);
8128
+ text += L" ]]" ;
8129
+ text += L" \r\n " ;
8130
+ for (auto & pair : pairs) {
8131
+ text += (WCHAR)0x3010 ; // 【
8132
+ text += pair.first ;
8133
+ text += (WCHAR)0x3011 ; // 】
8134
+ text += L" : " ;
8135
+ text += std::to_wstring (pair.second );
8136
+ text += L" \r\n " ;
8137
+ }
8138
+ }
8139
+
8061
8140
{
8062
8141
// パターンを読み込む。
8063
8142
patterns_t patterns;
@@ -8075,6 +8154,14 @@ void XgShowPatInfo(HWND hwndInfo)
8075
8154
for (const auto & pat : patterns) {
8076
8155
size2num[MAKELONG (pat.num_rows , pat.num_columns )] += 1 ;
8077
8156
}
8157
+ // パターンの個数。
8158
+ text += L" \r\n " ;
8159
+ text += L" [[ " ;
8160
+ text += XgLoadStringDx1 (IDS_PATCOUNT);
8161
+ text += L" ]] : " ;
8162
+ text += std::to_wstring (patterns.size ());
8163
+ text += L" \r\n " ;
8164
+ // パターンの頻度分布。
8078
8165
text += L" \r\n " ;
8079
8166
text += L" [[ " ;
8080
8167
text += XgLoadStringDx1 (IDS_PATSIZEDIST);
0 commit comments