Page 1 of 1

Help with "Tic-Tac-Toe" code

Posted: 21 Mar 2011 18:43
by scienceguru1.bat

Code: Select all

@echo off
echo Tic-Tac-Toe
pause
cls
:newgame
set /p a1="n"
set /p a2="n"
set /p a3="n"
set /p b1="n"
set /p b2="n"
set /p b3="n"
set /p c1="n"
set /p c2="n"
set /p c3="n"
echo You are X, you also get first move.
pause
cls
echo  %a1% | %a2% | %a3%
echo ---+---+---
echo  %b1% | %b2% | %b3%
echo ---+---+---
echo  %c1% | %c2% | %c3%
echo/
echo  a1 | a2 | a3
echo  ---+---+---
echo  b1 | b2 | b3
echo  ---+---+---
echo  c1 | c2 | c3
set /p "Enter spot to put a "X": "
pause


I know it's not complete. Also is there a way to have the variables set w/o having to hit enter 9 times?

Re: Help with "Tic-Tac-Toe" code

Posted: 22 Mar 2011 00:16
by phillid
What are the variables being set to?

Code: Select all

set /p variable="Enter Something"

Will need the user to type on the keyboard, and then store what they entered and store it in 'variable'

Code: Select all

set variable="Enter Something"

Will set 'variable' to have a value of "Enter Something" without asknig the suer for anything

Hope it helps!


phillid