// Create set attribute move internal static MovePartModel CreateSetAttribute(PlayerValue player, PositionValue position, PieceValue piece, IdentValue ident, TypedValue value) { var mpm = Create(MoveKinds.Attrib, player, position, piece); mpm.Attribute = ident; mpm.Value = value; return(mpm); }
internal void SetMoveFlag(IdentValue name, bool isset) { if (isset) { _move_flag_set.Add(name); } else { _move_flag_set.Remove(name); } }
internal void SetPositionFlag(IdentValue name, PositionValue position, bool isset) { if (isset) { _position_flag_set.Add(Pair.Create(position, name)); } else { _position_flag_set.Remove(Pair.Create(position, name)); } }
static internal long GetHash(IdentValue name) { long hash; if (_hashlookup.TryGetValue(name.Value, out hash)) { return(hash); } hash = _rng.Next(); hash = (hash << 32) | (long)_rng.Next(); _hashlookup[name.Value] = hash; return(hash); }
// typed getters internal bool GetBoolProperty(string name) { var ret = GetProperty(IdentValue.Create(name)); if (ret == null) { return(false); } if (ret.DataType == DataTypes.Bool) { return(ret == BoolValue.True); } if (ret.DataType == DataTypes.Text) { return(ret.AsString.ToLower() == "true"); } if (ret.DataType == DataTypes.Number) { return((ret as NumberValue).Value != 0); } return(false); }
internal bool GetMoveFlag(IdentValue name) { return(_move_flag_set.Contains(name)); }
internal TypedValue GetProperty(string name) { return(GetProperty(IdentValue.Create(name))); }
BoolValue s_PositionFlag_(IdentValue flag, PositionOrDirection posordir = null) { return(BoolValue.Create(_state.GetPositionFlag(flag, ToPosition(posordir)))); }
// conditions codes BoolValue s_Flag_(IdentValue flag) { return(BoolValue.Create(_state.GetMoveFlag(flag))); }
internal int GetIntProperty(string name) { var ret = GetProperty(IdentValue.Create(name)); return((ret == null) ? 0 : (int)(ret as NumberValue).Value); }
internal string GetStringProperty(string name) { var ret = GetProperty(IdentValue.Create(name)); return((ret == null) ? null : ret.AsString); }
internal bool IsAttributeSet(IdentValue attribute, PositionValue position) { return(IsPlayed(position) && _playedpieces[position].IsSet(attribute)); }
void s_SetFlag(IdentValue name, BoolValue value) { _state.SetMoveFlag(name, value.Value); }
internal bool GetPositionFlag(IdentValue name, PositionValue position) { return(_position_flag_set.Contains(Pair.Create(position, name))); }
internal void SetProperty(IdentValue ident, TypedValue value) { PropertyLookup[ident] = value; }
internal void SetProperty(string name, TypedValue value) { PropertyLookup[IdentValue.Create(name)] = value; }
BoolValue s_NotFlag_(IdentValue flag) { return(s_Not(s_Flag_(flag))); }
BoolValue s_NotPositionFlag_(IdentValue flag, PositionOrDirection posordir = null) { return(s_Not(s_PositionFlag_(flag, posordir))); }
internal void AddSetAttribute(IdentValue ident, BoolValue value) { _changes.Add(MovePartModel.CreateSetAttribute(Player, Position, Piece, ident, value)); }
internal TypedValue GetProperty(IdentValue name) { var value = PropertyLookup.SafeLookup(name); return(value); }
internal bool IsSet(IdentValue attribute) { return(AttributeLookup.SafeLookup(attribute) == BoolValue.True); }
void s_SetPositionFlag(IdentValue ident, BoolValue value, PositionOrDirection posordir = null) { _state.SetPositionFlag(ident, ToPositionSafe(posordir), value.Value); }