update
This commit is contained in:
@@ -331,27 +331,35 @@ end
|
||||
a game state
|
||||
|
||||
# Return
|
||||
- `(isterminal, reward)::Tuple{Bool, Number}`
|
||||
- `(isterminalstate, reward)::Tuple{Bool, <:Number}`
|
||||
|
||||
# Example
|
||||
```jldoctest
|
||||
julia>
|
||||
```
|
||||
|
||||
# TODO
|
||||
- [x] update docstring
|
||||
- [TESTING] implement the function
|
||||
|
||||
# Signature
|
||||
"""
|
||||
function isterminal(state::T)::Tuple{Bool, Number} where {T<:AbstractDict}
|
||||
function isterminal(state::T)::Tuple{Bool, <:Number} where {T<:AbstractDict}
|
||||
latestObservationKey, _ = GeneralUtils.findHighestIndexKey(state[:thoughtHistory], "Observation")
|
||||
latestObservation = state[:thoughtHistory][latestObservationKey]
|
||||
|
||||
# terminal condition is when the user select wine by putting <<winename>> in latest observation
|
||||
if occursin("<<", latestObservation) && occursin(">>", latestObservation)
|
||||
return true, 1
|
||||
if latestObservation !== nothing
|
||||
|
||||
# terminal condition is when the user select wine by putting <<winename>> in latest observation
|
||||
if occursin("<<", latestObservation) && occursin(">>", latestObservation)
|
||||
isterminalstate = true
|
||||
reward = 1
|
||||
else
|
||||
isterminalstate = false
|
||||
reward = 0
|
||||
end
|
||||
else
|
||||
isterminalstate = false
|
||||
reward = 0
|
||||
end
|
||||
|
||||
return (isterminalstate, reward)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user