[Gcblue-commits] gcb_wx/scripts AI.py,1.15,1.16
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-02-16 23:13:31
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15429/scripts Modified Files: AI.py Log Message: Parallel ai update Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AI.py 11 Dec 2004 01:09:06 -0000 1.15 --- AI.py 16 Feb 2005 23:13:23 -0000 1.16 *************** *** 39,42 **** --- 39,74 ---- ZigZagPatrol(UnitInfo) + def TestTask(TI): + UI = TI.GetPlatformInterface() + UI.SetHeading(UI.GetHeading() + 5) + + # test memory functions + iteration = TI.GetMemoryValue(1) + if (iteration == 0): + TI.SetMemoryText('test', UI.GetName()) + elif (iteration == 1): + memory_name = TI.GetMemoryText('test') + UI.DisplayMessage('%s: mem name is %s' % (memory_name, UI.GetName())) + + + # test blackboard + BB = TI.GetBlackboardInterface() + if (iteration == 0): + BB.Write('TestInfo', 'test info here') + + if (iteration == 2): + bb_item = BB.Read('TestInfo') + UI.DisplayMessage('%s: %s %d %f' % (UI.GetName(), bb_item.message, bb_item.author, bb_item.priority)) + + if (iteration == 3): + bb_msg = BB.ReadMessage('TestInfo') + bb_auth = BB.ReadAuthor('TestInfo') + bb_pri = BB.ReadPriority('TestInfo') + UI.DisplayMessage('%s: %s %d %f' % (UI.GetName(), bb_msg, bb_auth, bb_pri)) + + # increment iteration + iteration = iteration + 1 + TI.SetMemoryValue(1, iteration) + def AvoidGround(UI): *************** *** 88,92 **** def ZigZagPatrol(UI): targetid = UI.GetTarget() ! if targetid != 0xFFFFFFFF: InterceptTarget(UI) return --- 120,124 ---- def ZigZagPatrol(UI): targetid = UI.GetTarget() ! if targetid != -1: InterceptTarget(UI) return *************** *** 112,116 **** # engage hostiles in range track_id = GetSuitableTarget(UI) ! if (track_id != 0xFFFFFFFF): UI.SetTarget(track_id) UI.SetHeadingToInterceptTarget() --- 144,148 ---- # engage hostiles in range track_id = GetSuitableTarget(UI) ! if (track_id != -1): UI.SetTarget(track_id) UI.SetHeadingToInterceptTarget() |