#!/bin/bash # # These are instructions for using the ai-release code # to develop your agent for the Scavenger world, search # environment. They are written as a shell script with # comments. If you have any questions, please contact # me for clarification. Phone calls get quicker responses # than emails. # # Note that pushd temporarily visits a directory and # popd returns from that visit. # # The current release is: ai-release-y08m11d24.tgz # set variable so this can change release=ai-release-y08m11d24 # set the directory to install into dest_dir=${HOME}/f09/cs4300/mycode # go to destination directory if [ ! -d ${dest_dir} ]; then mkdir -p ${dest_dir} fi cd ${dest_dir} # download package if [ ! -e ${release}.tgz ]; then wget http://cit.cs.dixie.edu/cs/cs4300/sources/${release}.tgz fi # unpack the package if [ ! -d ${release} ]; then tar zxf ${release}.tgz fi # first time build: pushd ${release}/ai-agents/prog/PLTest # added "#include " at the top of the file emacs PL_Shell.cpp popd pushd ${release}/ai-agents/prog/ScavengerWorld # added "#include " at the top of the files emacs Snorlax.cpp Manual.cpp popd pushd ${release}/ai-agents/build/linux make configure make popd # # You can repeat this next step any time you want # to run the system again # # run the scavenger world worldfile="../../ai-agents/prog/ScavengerWorld/world-assignment-grade.txt" pushd ${release}/ai/bin ./RunProg ./SW_Test -D 1 -f ${worldfile} -O 1 -R 1 -t 1 & sleep 1 # wait for environment to get started ./RunProg ./SD_Test & ./RunProg ./SA_Test -a s -t 0 popd # # This step is one-time per agent creation # # to create your own agent pushd ${release}/ai-agents/prog/ScavengerWorld cp Snorlax.h YourAgent.h cp Snorlax.cpp YourAgent.cpp # change the name of the class and namespace in these two files emacs Snorlax.h Snorlax.cpp # add an entry for you agent in this file emacs AgentPrograms.pm # { # name => 'Snorlax', # agent name # key => 's', # command line key for your agent # header => 'Snorlax.h', # master header file for your agent # cpp => ['Snorlax.cpp'], # comma separated list of all .cpp files # constructor => 'ai::Sample::Snorlax()', # c++ code to call instructor # }, popd # build with your agent in place # look for compiler errors pushd ${release}/ai-agents/build/linux make popd # # At this point you can edit your sources, compile, and run # in a normal development cycle. Just be sure you are in # the right location for each operation. # # # I mistyped a file name in AgentPrograms.pm, now the build # will not work correctly. I fixed the problem in AgentPrograms.pm, # but make is still trying to find a file that doesn't exist. # # You need to remove the auto-generated file that is looking # for the non-existent file. pushd ${release}/ai-agents/build/linux/prog/ScavengerWorld rm Makefile.agents popd # Now you should be able to build again.