Help with "Tic-Tac-Toe" code

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
scienceguru1.bat
Posts: 44
Joined: 01 Jan 2011 20:54

Help with "Tic-Tac-Toe" code

#1 Post by scienceguru1.bat » 21 Mar 2011 18:43

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?

phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

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

#2 Post by phillid » 22 Mar 2011 00:16

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

Post Reply