Devam Ediyor

505828 Scripting with Lua

Extract the project folders and files from the archive [url removed, login to view] into your project directory. You should be able to open the solution file (.sln) to start VisualStudio.

Add the Lua and Boost Libraries to the Project

Get the lua-5.0 and luabind directories from the textbook's source code archive. These can be found in the VC6 projects/Common folder. Be sure to use the code from the "VC6 projects" folder and NOT the "VS8 projects" folder.

Get and extract the Boost library described on page 276. Make sure you get the Boost version 1.30.0. This version is available here: [url removed, login to view]

Change the project settings in VisualStudio to provide for the Lua and Boost include and library paths. In VisualStudio select Tools | Options from the menu. In the left pane, navigate to the Projects folder and select VisualC++ Directories.

In the upper right-hand corner, change the Show Directories for list box to Include Files, and add paths to your Boost folder, luabind folder, and lua-5.0\include folder:

In the upper right-hand corner, change the Show Directories For list box to Library Files, and add paths to your Boost folder and lua-5.0\lib folder:

Rebuild the Project

Run the program and examine the output.

The output should give you a list of Miner Bob doing activites.

The Miner will repeat the same thing.

Modify the Application

Modify the application so that the Miner's dialog is chosen from random depending on his state (GoHome, Sleep, or GoToMine) and whether the dialog is printed from the Enter, Execute, or Exit method. Provide 3 different things for the Miner to say for each state and method combination (a total of 27 strings). You can use the existing strings as the first nine.

The changes should only affect the file [url removed, login to view] file. Do not modify the C++ source code.

Add the following to the top of the Lua script file to seed the random number generator:

-- seed the random number generator so we get different outputs

[url removed, login to view]([url removed, login to view]())

STEP 6: Run the Application

Rebuild and Run the modified application.

The Miner's dialog will now vary randomly.

Beceriler: Her şey Kabul, C Programlama, PHP, Kabuk Betiği, Web Sitesi Yönetimi

Daha fazlasını gör: strings in c programming, sleep programming, programming lua, programming libraries, programming in lua, php projects with source code, math programming, math in programming, math and programming, do your math, c random number library, c programming strings, c programming random number, archive top, get math, textbook, sln-, Math projects, lua, hand tools, c# lua scripting, c lua scripting, miner project php, combination number generator, seed random number generator

İşveren Hakkında:
( 3 değerlendirme )

Proje NO: #2251753