tailieunhanh - Best of Ruby Quiz Pragmatic programmers phần 3

Hai người chơi lần lượt điền vào một hình vuông mở ra với biểu tượng của họ. Người đầu tiên để chơi sử dụng X, và các cầu thủ khác sử dụng O. Các cầu thủ đầu tiên để có được một hoạt động của ba biểu tượng trên, xuống, hoặc theo đường chéo thắng. | Quiz 22. Learning Tic-Tac-Toe 52 Quiz 22 225 Learning Tic-Tac-Toe This Ruby Quiz is to implement some AI for playing tic-tac-toe with a catch you re not allowed to embed any knowledge of the game into your creation beyond making legal moves and recognizing that it has won or lost. Your program is expected to learn from the games it plays until it masters the game and can play flawlessly. Tic-tac-toe is a very easy game played on a 3x3 board like this I I II II Two players take turns filling a single open square with their symbol. The first person to play uses Xs and the other player uses Os. The first player to get a run of three symbols across down or diagonally wins. if the board fills without a run the game is a draw. Here s what a game won by the X player might end up looking like I I X I X I -- -- -- X I O I O Submissions can have any interface but should be able to play against humans interactively. However i also suggest making it easy to play against another Ai player so you can teach the program faster. Being able to monitor the learning progression and know when a program has mastered the game would be very interesting if you can find a way to incorporate it into your solution. Report erratum Quiz 23. Countdown 53 Quiz Answer on page 239 23 Countdown Posed by Brian Candler One of the longest-running quiz shows on British television is called Countdown. That show has a numbers round. Some cards are laid face down in front of the host. The top row contains large numbers from the set 25 50 75 and 100 and the rest are small 1 to 10 . Numbers are duplicated in the cards. Six cards are picked and displayed the choice is made by one of the contestants who typically will ask for one large number and five small ones. Next a machine called Cecil picks a target number from 100 to 999 at random. The contestants then have 30 seconds to find a way of combining the source numbers using the normal arithmetic operators - and to make the target number or to get as close as

TỪ KHÓA LIÊN QUAN