Đang chuẩn bị liên kết để tải về tài liệu:
Microsoft WSH and VBScript Programming for the Absolute Beginner Part 40

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 40. If you are new to programming with Microsoft WSH and VBScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical WSH and VBScript programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book,. | Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition Script Name TicTacToe.vbs Author Jerry Ford Created 11 15 04 Description This script is a VBScript implementation of the Tic-Tac-Toe game Initialization Section Option Explicit Const cTitleBarMsg VBScript T I C T A C T O E Dim A1 A2 A3 B1 B2 B3 C1 C2 C3 Variables representing sections of the Tic Tac Toe game board Dim blnGameOver Boolean variable that determines when to end game Dim blnPlayerTypedQuit Dim blnStopGame Variable used to track whether a player typed Quit Variable used in Main Processing section to determine when to stop the game Dim blnValidCell Boolean variable that determines whether a player specified a valid cell Dim intNoMoves Variable used to keep track of the number of plays Dim intPlayAgain Variable holds player response when asked to play again Dim strNotificationMsg Dim strPlayer Dim strWinner Variable used to display messages to player Variable used to identify whose turn it is Variable used to determine whether the game is won Dim strPlayerInput Dim strDirection Variable used to hold the player s cell selection Variable identifies how the player won the game blnStopGame False Chapter 11 Working with Built-In VBScript Objects Developing the Logic for the Main Processing Section The game s main processing section is made up of a Do Until loop and a series of procedure calls. The loop is set up to execute until the players decide to stop playing the game as tracked using a Boolean variable named blnStopGame. Do Until blnStopGame True Keep playing until players decide to stop SetVariableDefaults ClearGameBoard ManageGamePlay If blnPlayerTypedQuit True Then One of the players typed Quit blnStopGame True Else The game is over. Ask the players whether they d like to play again intPlayAgain MsgBox Would you like to play another game of _ Tic Tac Toe 4 cTitleBarMsg If intPlayAgain 7 Then A player clicked on No. B break out of loop blnStopGame True End If End If Loop .