# OK to post homework # Lucy Martinez, 04-17-22, Assignment 23 read `C23.txt`: #----------------------Problem 2-----------------------# # Read the wikipedia article on the Centipede game and write a procedure WikiCent(n) # That generalizes the four-stage game given there with payoffs (1,0),(0,2),(3,1),(2,4) at the bottom # and to the extereme right (3,3) but please change the (3,3) to (3.1,3.1) to a 2n-stage game with payoffs, # at the bottom (1,0),(0,2),(3,1),(2,4),(5,3),(4,6) ...., (2n-2,2n) and to the extereme right (2n-1+ 0.1,2n-1+0.1) # It should be expressed in our data-structure like in Els() above. Name the n non-leaves on the top row in order, # followed by the leaf at the extreme right, followed by the leaves at the bottom. # The second part should be the reward table (but with our convention that the pair of rewards is [a,b], # where a is the reward of the player currently at that vertex and b the reward of the other player. # Regardless whether they happen to be Player I or Player II. WikiCent:=proc(n) local i: [seq({ i,i+2*n },i=2..2*n+1 ),seq({},i=1..2*n+1)],[2*n+1,[2*n-1+0.1,2*n-1+0.1]],seq([2*n+1+i,[ i,max(i-2,0)]],i=1..2*n-1),[4*n+1,[2*n-2,2*n]]: end: WikiCent(2); # [{2, 6}, {3, 7}, {4, 8}, {5, 9}, {}, {}, {}, {}, {}], # [5, [3.1, 3.1]], [6, [1, 0]], [7, [2, 0]], [8, [3, 1]], [9, [2, 4]] #----------------------Problem 3-----------------------# # By going back to at least your four grandparents (but the further back the better!) describe your # own family "tree" (it is not really a tree, but a directed graph). Express it in our notation as a # directed graph, followed by the "dictionary" the list of names such that L[i] is the name in real life # of the vertex named i. # Apply GenS(G), and LaGn(G) to your family graph. # For the most ancient generation in GenS(G) (the last in the list), find whether they are winning or losing # if you use it to play the game. # The following is the list of people in my family. The numbers correspond to the index in the list L # L:=[Sabina 1, Dario 2, Maria 3, Manuel 4, Elvia 5, Abel 6, Felisa 7, Felipe 8, Mercedes 9, # Eufemia 10, Pilar 11, Otilia 12, Berta 13, Martha 14, Beto 15, Ruben 16, Edvin 17, Santos 18, # Gilberto 19, Oralia 20, Maria 21, Manuel 22, Arnoldo 23, Rudy 24, Jose 25, Lucila 26, Juan 27, # Gilberto 28, Mayra 29, Abel 30, Elfego 31, Irene 32, Felipe 33, Maynor 34, Hugo 35, Jose 36, # Auri 37, Jilmer 38, Cristina 39, Magali 40, Keyli 41, Juana 42, Manuel 43, Victor 44, # Lucila 45, Mariano 46, Luis 47, Edgar 48, Christian 49, Gerber 50, Samantha 51, Rudy 52, # Mariana 53, Nehemias 54, Jessica 55, Lucy 56, Jaquelyne 57, Bryan 58, David 59, Anna 60, # Pamela 61, Maricela 62, Josue 63, Daniel 64, Esmeralda 65, Diana 66, Elmar 67, Kevin 68, # Brandon 69, Elvia 70, Lilian 71, Ervin 72, Gorge 73, Yerik 74, Maynor 75, Madeline 76, # Vanessa 77, Astrid 78, Hugo 79, Ebony 80, Christopher 81, Bradley 82, Jadiel 83, Stacey 84, # Jasmin 85, Lilian 86]: G:=[{9,10,11,12,13,14,15,16,17},{10,11,12,13,14,15,16,17},{18},{18},{19},{19},{20},{20}, {21,22,23,24,25,26},{},{},{},{},{},{},{},{},{21,22,23,24,25,26},{27,28,29,30,31,32,33,34,35,36},{27,28,29,30,31,32,33,34,35,36}, {37,38,39,40,41},{42,43,44,45},{46,47,48},{49,50,51,52,53,54},{55},{56,57,58},{56,57,58},{59,60,61},{62,63,64},{65,66},{67,68,69},{70,71,72,73},{74},{75},{76,77,78,79},{80,81,82}, {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{83,84,85,86},{},{},{},{},{},{},{},{},{},{},{}]; # I ran GenS(G) but it took too long and it never ended :( I will try again