Esempio n. 1
0
        public void Add(GikouBookEntry entry)
        {
            if (!this.entries.ContainsKey(entry.Key))
            {
                // ない場合
                this.entries.Add(entry.Key, new List <GikouBookEntry>());
            }

            this.entries[entry.Key].Add(entry);
        }
Esempio n. 2
0
        public static GikouBookEntry FromBytes(byte[] data, int ofs)
        {
            GikouBookEntry entry = new GikouBookEntry();

            entry.Key = BitConverter.ToInt64(data, ofs + 0);
            entry.Move.Set(BitConverter.ToUInt32(data, ofs + 8));
            entry.Frequency = BitConverter.ToUInt32(data, ofs + 12);
            entry.WinCount  = BitConverter.ToUInt32(data, ofs + 16);
            entry.Opening   = BitConverter.ToUInt32(data, ofs + 20);
            entry.Score     = BitConverter.ToInt32(data, ofs + 24);

            return(entry);
        }
Esempio n. 3
0
        private void LoadEntrys(Stream sr)
        {
            byte[] data = new byte[GikouBookEntry.EntrySize];

            while (true)
            {
                int len = sr.Read(data, 0, GikouBookEntry.EntrySize);

                if (len < GikouBookEntry.EntrySize)
                {
                    break;
                }

                GikouBookEntry entry = GikouBookEntry.FromBytes(data, 0);
                this.Add(entry);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 追加
        /// </summary>
        public void Add(long key, uint frequency, uint win_count, int score, GikouMove move)
        {
            GikouBookEntry entry = new GikouBookEntry()
            {
                Key       = key,
                Move      = move,
                Frequency = frequency,
                WinCount  = win_count,
                Score     = score,
            };

            if (!this.entries.ContainsKey(key))
            {
                // ない場合
                this.entries.Add(key, new List <GikouBookEntry>());
            }

            this.entries[key].Add(entry);
        }