Program 1: the environment manipulator
@echo off
title environment manipulator
cls
start resp.bat
:start
cls
echo Environment 1: A flat, hard, open space.
echo Environment 2: A room with an uneven floor with a door at one end.
echo Environment 3: A room with a flat, hard floor and walls and a ball in the center.
echo Environment number? (1, 2, or 3)
set /p env= :
echo %env% > env.txt
echo Task 1: Explore the area.
echo Task 2: Move towards and open the door.
echo Task 3: Pick up the ball.
echo Task number? (1, 2, or 3)
set /p task= :
echo %task% > task.txt
start main.bat
goto start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Program 2: The central "brain." The decision matrix or the thought process
(it's really gross, sorry. I just left in a bunch of stuff and I need to clean it up.)
@echo off
title main sensory (decision matrix)
cls
:start
cls
if not exist env.txt goto start
if not exist task.txt goto start
set /p env=< env.txt
set /p task=< task.txt
if %task% equ 1 goto task1
if %task% equ 2 goto task2
if %task% equ 3 goto task3
:checkenv
if %env% equ 1 goto is1
if %env% equ 2 goto is2
if %env% equ 3 goto is3
goto start
:task1
if %env% equ 1 goto st1e1
if %env% equ 2 goto st1e2
if %env% equ 3 goto st1e3
goto start
:st1e1
set action=I explore and find that the area is open and the floor is hard and flat.
goto is1
:st1e2
set action=I explore and find that I am in a room with an uneven floor and a door at one end.
goto is2
:st1e3
set action=I explore and find that there is a ball in front of me and that the room is flat and has walls.
goto is3
:task2
if %env% equ 1 goto st2e1
if %env% equ 2 goto st2e2
if %env% equ 3 goto st2e3
goto start
:st2e1
set action=There is not a door to open.
goto is1
:st2e2
set action=I walk towards the door and gently open it.
goto is2
:st2e3
set action=I do not see a door here.
goto is3
:task3
if %env% equ 1 goto st3e1
if %env% equ 2 goto st3e2
if %env% equ 3 goto st3e3
goto start
:st3e1
set action=I do not see a ball here.
goto is1
:st3e2
set action=There is not a ball in here.
goto is2
:st3e3
set action=I pick up the ball.
goto is3
:is1
echo @echo off > resp.bat
echo title Response Batch >> resp.bat
echo :start >> resp.bat
echo echo %action% >> resp.bat
echo cls >> resp.bat
echo goto start >> resp.bat
exit
goto start
:is2
echo @echo off > resp.bat
echo title Response Batch >> resp.bat
echo :start >> resp.bat
echo echo %action% >> resp.bat
echo cls >> resp.bat
echo goto start >> resp.bat
exit
goto start
:is3
echo @echo off > resp.bat
echo title Response Batch >> resp.bat
echo :start >> resp.bat
echo echo %action% >> resp.bat
echo cls >> resp.bat
echo goto start >> resp.bat
exit
goto start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Program 3: the response program
For all intense and purposes, there is no code here. This is because the code is re-written based on what the main interpreter thinks it should do. The code is correctly changed, but the program is crashing when the code is changed. I tried changing the interpreter to add a timeout for 1 second before the echo echo %action%>>resp.bat however, when I did this, it crashed in a different way. This time, instead of the response just closing, it switched to the default command prompt user interface (the thing that says C:\ when you open cmd.)
Any thoughts on this issue?
No comments:
Post a Comment