Page 1 of 1

Debug and Rate AI code

Posted: 20 Jun 2022 16:07
by RedBeard
I found an open AI and decided to have it write a batch file, tell me whats wrong with it (because it doesnt work) and rate the AIs skill level.

Here is what was asked:

"Write batch file code for windows 7 that uses a key to encrypt and decrypt messages in window."

Code: Select all

@echo off

setlocal

set key=1234

:start

echo Enter 1 to encrypt a message, 2 to decrypt a message, or 3 to exit

set /p choice=

if %choice%==1 (

echo Enter the message to encrypt:

set /p message=

for /f "tokens=*" %%a in ('%message%') do set "encrypted=!encrypted!%%a"

echo The encrypted message is: %encrypted%

)

if %choice%==2 (

echo Enter the message to decrypt:

set /p message=

for /f "tokens=*" %%a in ('%message%') do set "decrypted=!decrypted!%%a"

echo The decrypted message is: %decrypted%

)

if %choice%==3 exit

goto start

Re: Debug and Rate AI code

Posted: 24 Sep 2022 03:09
by batmanbatmanbatmen
First, use setlocal enabledelayedexpansion
2rd, inside for loop, you can try ('echo xxx') instead of ('xxx'). Sometime is ok.
3nd, I don't understand your encrypted message method. Do you want to remove space in "message" or merge all input message to one ?

For example as below, is it correct ?
1st round:
message=I am a boy. The encrypted message= I am a boy
2nd round:
message=You are a girl. The encrypted message= I am a boyYou are a girl