def my_lin_interp (x_list, y_list,x_val): print("interpolitan formula:y (X)=y1+ [(y2-yl)/(x2- x1)] (x-x1) where x1-->xi
Posted: Tue Jul 05, 2022 10:26 am
Program Logic: You must use a double linked list to represent the Board. Your program should start by creating nodes in the double linked list to represent the board. You need to determine the class (data type) of an element in a node, and the information that element needs to hold. That information should include attributes of the board space. Your program should also be able to print the Board, and show the current position of each player. The layout of this printout must have 3 rows as shown in the diagram. Play 1000 games with only Player A in the game. Output the average number moves it takes to win. Next play 1000 games with player A and B. Note the average for each of them to win. Do this for up to 4 players. A sample matrix would be: RESULTS TABLE Player in game A A,B A,B,C A,B,C,D Player A average moves/% winning 30, 100% 25/ 62% 23/ 35% 22 / 27% Player B average moves/ % winning 27/38% 24/ 62% 20/ 25% Player C average moves/ % winning 26 / 62% 21/ 24% Player D average moves/ % winning 24/ 24% Expected Actual numbers will be provided during the project period for comparison. Print the game board for every 100th game at the end of the game, so one can see the final position of each player.. So you will have 10 board prints for each row above. Notes on coding 1) You may use and modify the Double LinkedList class. This includes modifying the nested Node class. 2) Make sure to use plenty of loops 3) Be creative displaying the game board. Outputs 1) Your program should print the board at the end of the game for the first game, 101st game, 201st game..etc. In all your output would have 40 prints of the board. 2) Your output should include the Results Table above. Note: Your list representing the Board should hold the players currently at that position. You will need to search for where a player currently is, in order to move the player.
In this project you will help determine the probability of winning a board game. Your program will represent the board in a double linked list. Your program will also simulate playing the game with 1,2,3 and finally 4 players. The program will output the average number of moves necessary for one of the players to "win" the game. Objectives The goal of this programming project is for you to master (or at least get practice on) the following tasks: Representing a real life board game within a data structure Modifying the code of an ADT . Employing simulation techniques • Writing classes • Working with existing code Start early! This project may not seem like much coding, but debugging always takes time. Analyze and plan now so questions are not being asked a day before the due date. Board Game: START 5 10 8 10 7 5 9 10 6 10 6 5 8 9 5 10 5 9 6 8 7 10 6 8 END Board Game rules: A player begins the game on the Start circle. The current player rolls a dice, that gives a number from 1 to 6. The current player moves that many colored blocks from the current player's position. If the square is unoccupied, then the current player adds the number on the square to the player's total. If the square already has a previous player on it, the previous player has to go back 7 spaces, and the current player adds the number on the square to the current player's total. If a player moves back 7 spaces and shares a block with another player, that's ok- no additional processing. If the player is moved back beyond the first square, put the player on Start circle. Use the Board Shown Above When a player reaches the End circle or beyond, and has at least 44 points the game is over. When a player reaches the End circle or beyond, and has less than 44 points, the player must go back to the Start. A player can never go before the start square or after the end square. If a player's roll would move the player beyond the End square, then the player is put on the End square.
Q3. (4 pts) Considering following context free grammar G = ({S, A, B, K, U, T, V, W, Y, Z}, {a, b}, P, S) with below production rules S→ AV |AB|SB|WY|ZV|BV|ZB|BB|UU|a|b Ub V→ SB W → SU Y→ US Z → BA T→UA K → SA A → TK | TA|US|a|b decide employing the Cocke Kasami Younger (CKY) algorithm whether the string "x = aabab" belongs to the language L(G). Important. Recall that CKY algorithm functions on grammars in Chomsky Normal Form (CNF). Therefore make sure before employing the algorithm that G is already in CNF; transform G into an equivalent grammar in CNF, otherwise.