changeState
2017-03-27 00:29:24 0 举报
changeState是一个函数,用于改变对象的状态。它通常在面向对象的编程语言中被使用,如JavaScript、Java等。这个函数接收一个新的状态作为参数,并将对象的当前状态替换为新的状态。例如,如果有一个表示汽车的类,其中包含一个表示其速度的属性,那么可以使用changeState函数来改变汽车的速度。 此外,changeState也可以指代一种编程模式,即状态模式(State Pattern)。在这种模式中,一个对象的状态可以由另一个对象来决定和改变。这种模式通常用于处理具有多个不同状态的对象,以便在这些状态之间进行转换。
作者其他创作
大纲/内容
enough fuel to the see the target and back to fuel station
Yes
explore the route
No
REFRESH
enough fuel from the station with task to fuel station
back to fuel station
EXISTINGTASKS
task list is empty
Brain Command
enough fuel from closest well to fuel station
enough fuel for next step to back to fuel station
add water & fuel (existing tasks but the agent has no ability to perform)
Refresh withinput: Refresh station list
EXPLORING
has water
Do tasks
move to to the target
move to the target
go to closest well
0 条评论
下一页