Coursehelp
April 20, 2019

(Solved) : Code Program Include Splashkith Include Using Namespace Std Int Converttointeger String Pr Q30891003 . . .

All the code for this program-

#include “splashkit.h”

#include <string>

using namespace std;

int convert_to_integer( string prompt)

{

int result;

result = convert_to_integer(prompt);

return result;

}

{

string result;

write(prompt);

return result;

}

{

string line;

return convert_to_integer(line);

}

void output_crazy_age(int age)

{

write(to_string(age) + “is a”);

int i = 0;

while ( i < 5 )

{

write(“crazy”);

// i = i + 1;

i++;

}

write_line(” age “);

}

{

write_line(“3. Guess that number”);

write_line(“4. Quit”);

}

void test_user_name()

{

string name;

string line;

write_line(“Hello “+ name);

if (name == “Sir Kap”)

{

write_line(” Bravely bold Sir Kap…”);

write_line(” He was not afraid to save innocent people…”);

}

else

{

if (name == “Benson”)

{

write_line(” Hello My King”);

}

}

}

void test_user_age()

{

int age;

string line;

age = convert_to_integer(line);

write(“Age: “);

write_line(age);

if ( age == 35 or age == 80 )

{

write_line(“Intersing Age!”);

}

else if ( age < 0 or age > 100 )

{

write_line(“Are you serious?”);

}

else if ( age > 5 and age < 10 )

{

output_crazy_age(age);

}

else

{

write_line(“Great you are ” + to_string(age));

}

}

void play_guess_that_number()

{

string line;

int guess;

int target;

target = rnd(100) + 1;

write_line(“I`m thinking of a number between 1 and 100”);

while ( guess != target)

{

write(“Enter guess: “);

guess = convert_to_integer(line);

if (guess < target)

{

write_line(“Sorry, my number is greatter than ” +to_string(guess));

}

else if (guess > target )

{

write_line(“No, my number is less than ” +to_string(guess));

}

}

write_line(“WoW… you got it. My number was ” +to_string(target));

}

int main()

{

string name;

int option;

do

{

option = read_integer(” Choose option: “);

switch(option)

{

case 1:

test_user_name();

break;

case 2:

test_user_age();

break;

case 3:

play_guess_that_number();

break;

case 4:

write_line(“See you later…”);

break;

default:

}

}while(option != 3);

return 0;

}

Question1) Fix the Code

Problem – No declaration, trying to redefine an existingfunction – they all contribute to program errors

Comment on the program regarding this issue-

more than one instance of overloaded function”convert_to_integer” matches the argument list

1 include “splashkit.h #1nclude using ransspace std; 6 int convert to integerf string propt) int result resuit convert to integerlpronpt) return result; 6 string read tring(string pronpt) string result vrite(preept) result read_linel0: Show transcribed image text 1 include “splashkit.h #1nclude using ransspace std; 6 int convert to integerf string propt) int result resuit convert to integerlpronpt) return result; 6 string read tring(string pronpt) string result vrite(preept) result read_linel0: Asked Sep. 10, 2018

. . .

Coursehelp

(Solved) : Code Provided Kotlin Needs Changed Object Oriented Style Instructions Provided Within Code Q31155907 . . .

The code Provided in Kotlin, needs to be changed intoobject-oriented style. All instructions are provided within thecode as comments. Please change it accordingly.

import java.io.File// this function wouldn’t be needed if using a collection like a// mutable list, arraylist, etc — they can dynamically grow bigger// all this function does is figure out how many lines are in the filefun filesize(): Int { val dataset = File(“src/resources/dataset.txt”).bufferedReader() var fsize = 0 while (true) { val line = dataset.readLine() if (line == null) return fsize fsize += 1 } }// this is NOT a object-oriented program – it reads// a file into three arrays so that name[i] is the // name of the person from record i of the file, // idnum[i] is the id number of that person, and // amount[i] is an amount for that person // Your goal is to rewrite or refactor this program // so that it has a minimal main program, and puts // the code into class, method, object, companion // object, etc — more Object Oriented style of programfun main(args: Array<String>) { // read the input into name, idnum, and amount arrays val n = filesize() val name = Array<String>(n,{i -> “”}) val idnum = Array<Int>(n,{i -> 0}) val amount = Array<Double>(n,{i -> 0.0}) // read the file into the arrays val dataset = File(“src/resources/dataset.txt”).bufferedReader() for (i in 0 until n) { val line = dataset.readLine() if (line == null) break val fields = line.split(“,”) name[i] = fields[0] idnum[i] = fields[1].toInt() amount[i] = fields[2].toDouble() } // make a function to print one record using the arrays fun show(indx:Int): String = “Record(\${name[indx]},\${idnum[indx]},\${amount[indx]})” // make a function to look up a name, returning an index fun lookupName(find:String): Int { for (i in 0 until name.size) { if (find == name[i]) return i } return -1 // if name not found } // make a function to find index of maximum amount fun maxAmount(): Int { var maxamt = 0.0 var rememberIndex = 0 for (i in 0 until amount.size) { if (amount[i]>maxamt) { maxamt = amount[i] rememberIndex = i } } return rememberIndex } fun setAmount(newamt:Double,indx:Int) { amount[indx] = newamt } fun setAmount(newamt:Double,name:String) { amount[lookupName(name)] = newamt } fun setIdnum(newid:Int,index:Int) { idnum[index] = newid } fun setIdnum(newid:Int,name:String) { idnum[lookupName(name)] = newid } // here is some simple testing of these functions and the data val samplename1 = “HDQJwSQdyyFh” println(“Lookup of \$samplename1 is \${show(lookupName(samplename1))} ) setIdnum(123456789,samplename1) println(“Revised Lookup of \$samplename1 is \${show(lookupName(samplename1))} ) val samplename2 = name[29] println(“Lookup of \$samplename2 is \${show(lookupName(samplename2))} ) setAmount(88888.88,samplename2) println(“Revised Lookup of \$samplename2 is \${show(lookupName(samplename2))} ) }

. . .

Coursehelp

(Solved) : Code Python First Ghesoon Last Name Karim Stores First Name Variable Using Lowercase Lette Q30177665 . . .

code in Python

first: ghesoon

last name: karim

Stores your first name as a variable using all lowercaseletters

Stores your last name as a variable using all uppercaseletters

Prints out, “Hello, <first name> <last name>” withthe first name converted to uppercase letters and the last nameconverted to lowercase letters

Prints out two newlines

Prints out the following:

“Start by doing what’s necessary; then do what’s possible; andsuddenly you are doing the impossible – Francis ofAssisi”

Your output must have quotes at the beginning and the end of youroutputted text

Stores 2 decimal numbers as variables

Stores one addition, one subtraction, one multiplication, andone division operation of these variables as variables

Prints out each of the four results as:

<numeric value of variable 1> plus <numeric value ofvariable 2> equals <value of variable that stored the resultof addition>

<numeric value of variable 1> minus <numeric value ofvariable 2> equals <value of variable that stored the resultof subtraction>

…etc. Each output should be on its own line

Stores the current month as a string variable (e.g. March, June,etc.) and day of the month as a numeric variable

Outputs “Today is day <day of month> of the month of<month variable>.

. . .

Coursehelp

(Solved) : Code Public Class Wrongquizgradeexception Extends Exception Wrongquizgradeexception System Q29097324 . . .

THIS IS MY CODE  :

System.err.println(“Quizz Grade Must Be Between 0 and10!!!!”);

}

}

=====

import java.io.Serializable;

import java.util.ArrayList;

import java.util.Iterator;

public class Student implementsComparable<Student>,Serializable{

private String name;

private Integer ID;

private Double GPA;

Student (String name, Integer ID, Double GPA){

this.name=name;

this.ID=ID;

this.GPA=GPA;

}

public void SetName(String n) {name=n;}

public void SetID(Integer id) {ID=id;}

public void SetGPA(Double GPA)  { this.GPA=GPA;}

public String getName() {return name;}

public Integer getID() {return ID;}

public Double getGPA() { return GPA; }

}

}

public double quizzesAvg() {

double sum=0.0;

while (I.hasNext()) {

sum+=I.next();

}

}

public void Print() {

System.out.println(“Name: “+name+”nID: “+ID+”nGPA:”+GPA);

while (I.hasNext()) {

System.out.print(I.next()+”  “);

}

System.out.println(“nThe Avg:”+quizzesAvg()+”nnn”);

}

/*

public String toString() {

return “Name: “+name+”, ID:”+ID+” ,GPA:”+GPA+” ,TheQuizz Avg: “+this.quizzesAvg()+”n”;

}

*/

public int compareTo(Student s) {

return this.ID – s.ID;

}

}

======

class Node< T extends Comparable< T > >{

//package access members

Node< T > leftNode; // left node

T data; // node value

Node< T > rightNode; // right node

//constructor initializes data and makes this a leafnode

public Node( T nodeData ) {

data = nodeData;

leftNode = rightNode = null; // node has nochildren

} // end TreeNode constructor

//locate insertion point and insert new node; ignoreduplicate values

public void insert( T insertValue ) {

// insert in left subtree

if ( insertValue.compareTo( data ) < 0 ) {

// insert new TreeNode

if ( leftNode == null )

leftNode = new Node< T >( insertValue );

else // continue traversing left subtreerecursively

leftNode.insert( insertValue );

} // end if

// insert in right subtree

else if ( insertValue.compareTo( data ) > 0 ) {

// insert new TreeNode

if ( rightNode == null )

rightNode = new Node< T >( insertValue );

else // continue traversing right subtreerecursively

rightNode.insert( insertValue );

} // end else if

} // end method insert

} // end class TreeNode

=====

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.ObjectOutputStream;

import java.util.Formatter;

import java.util.FormatterClosedException;

class StudentTree< T extends Comparable< T >> {

private static final String Student = null;

private Node< T > root;

//constructor initializes an empty Tree ofintegers

public StudentTree() {

root = null;

} // end Tree no-argument constructor

//insert a new node in the binary search tree

public void insertNode( T insertValue ) {

if ( root == null )

root = new Node< T >( insertValue ); // createroot node

else

root.insert( insertValue ); // call the insertmethod

} // end method insertNode

//begin inorder traversal

public void inorderTraversal() {

inorderHelper( root );

} // end method inorderTraversal

//recursive method to perform inorder traversal

private void inorderHelper( Node< T > node ){

if ( node == null )

return;

inorderHelper( node.leftNode ); // traverse leftsubtree

((Student)(node.data)).Print();  // output nodedata

inorderHelper( node.rightNode ); // traverse rightsubtree

} // end method inorderHelper

public boolean search(T X) {

return searchHelper( root , X );

private boolean searchHelper( Node< T > node, TX ) {

if ( node == null )

return false;

else

if (node.data==X)

return true;

return (searchHelper( node.leftNode, X) ||searchHelper( node.rightNode, X));

}

public double MaxQuizzAvg(){

return MaxQAvgHelper( root );

}

double MAX=0;

private double MaxQAvgHelper(Node< T > node){

if (node==null)

return 0;

double X=((Student)(node.data)).quizzesAvg();

if ( X > MAX )

MAX = X;

MaxQAvgHelper( node.leftNode );

MaxQAvgHelper( node.rightNode );

return MAX;

}

public void QuizAvg(){

QuizAvgHelper( root );

}

private void QuizAvgHelper(Node< T > node) {

if (node==null)

return;

double X=((Student)(node.data)).quizzesAvg();

System.out.println(X);

QuizAvgHelper( node.leftNode );

QuizAvgHelper( node.rightNode);

}

public void ChangeGPA(int ID, double GPA){

ChangeGPAHelper( root ,ID, GPA);

}

private void ChangeGPAHelper(Node< T > node, intID, double GPA) {

if (node==null)

return;

int X=((Student)(node.data)).getID();

if( ID == X ){

((Student)(node.data)).SetGPA(GPA);

}

ChangeGPAHelper( node.leftNode ,ID, GPA);

ChangeGPAHelper( node.rightNode ,ID ,GPA);

}

public double gpaAvg(){

return gpaSum( root) / NumOfStudent(root );

}

private double gpaSum(Node< T > node) {

if (node==null)

return 0;

double GPASum= ((Student)node.data).getGPA() +gpaSum(node.leftNode) + gpaSum( node.rightNode );

return  GPASum;

}

private int NumOfStudent(Node< T > node) {

if (node==null)

return 0;

return 1+NumOfStudent( node.leftNode) + NumOfStudent(node.rightNode );

}

public void SaveTree(String FileName) {

FileOutputStream F=null;

ObjectOutputStream Out=null;

try {

F=new FileOutputStream(FileName);

Out=new ObjectOutputStream( F );

}catch( IOException e1 ) {

System.err.println(“Error opening or creatingfile.”);

}

SaveTreeHelper( root , Out );

}

private void SaveTreeHelper( Node<T> node,ObjectOutputStream Out) {

if (node==null)

return;

Student S = (Student)node.data;

try {

Out.writeObject(S);

} catch (IOException e) {

e.printStackTrace();

}

SaveTreeHelper( node.rightNode ,Out);

SaveTreeHelper( node.leftNode ,Out);

}

} // end class Tree

=====

public class Test {

public static void main(String[] args) {

Student S=new Student (“Ali”,67,3.0);

try {

e.getMessage();

}

try {

e.getMessage();

}

try {

e.getMessage();

}

try {

e.getMessage();

}

try {

e.getMessage();

}

//System.out.println(S.quizzesAvg());

S.Print();

System.out.println(S);

}

}

======

import java.io.EOFException;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

import java.io.ObjectOutputStream;

public class BTest {

static void printFile(String f1) {

FileInputStream File=null;

ObjectInputStream In=null;

try {

File=new FileInputStream(f1);

In=new ObjectInputStream(File);

while( true ) {

S.Print();

}

} catch (EOFException e1) {

System.out.println(“The end of file wasreached..”);

} catch ( IOException ioException ) {

System.err.println(“Error opening file.”);

} catch ( ClassNotFoundException e2 ) {

}

}

//In.close();

FileInputStream File=null;

ObjectInputStream In=null;

StudentTree <Student> STree=new StudentTree<Student>();

try {

File=new FileInputStream(f1);

In=new ObjectInputStream(File);

while (true){

//System.out.println(“t>> “+S);

STree.insertNode( S );

}

} catch (EOFException e1) {

System.out.println(“The end of file wasreached..”);

} catch ( IOException ioException ) {

System.err.println(“Error opening file.”);

} catch ( ClassNotFoundException e2 ) {

}

return STree;

}

public static void main(String[] args) {

Student []S=new Student[7];

S[0]=new Student(“Ali”,1,100.0);

S[1]=new Student(“Haya”,2,5.0);

S[2]=new Student(“Nora”,3,100.0);

S[3]=new Student(“Sara”,4,5.0);

S[4]=new Student(“Nasir”,5,100.0);

S[5]=new Student(“Ahmed”,6,5.0);

S[6]=new Student(“Arwa”,7,100.0);

try {

System.out.println(S[0].quizzesAvg());

System.out.println(S[1].quizzesAvg());

e.printStackTrace();

}

FileOutputStream file = null;

ObjectOutputStream Output = null;

try {

file = new FileOutputStream(“student1.ser”);

Output = new ObjectOutputStream( file );

for(int i=0; i<S.length; i++ ) {

Output.writeObject( S[i] );

}

} catch (EOFException e1) {

System.out.println(“The end of file wasreached..”);

} catch ( IOException ioException ) {

System.err.println(“Error opening file.”);

System.out.println(“====== The File =======”);

printFile(“student1.ser”);

StudentTree <Student> STT=null;//newStudentTree<Student>();

System.out.println(“n========= In Order==========n”);

STT.inorderTraversal();

System.out.println(“The Students Gpa Avg=”+STT.gpaAvg());

STT.ChangeGPA(5, 300);

System.out.println(“nnnIn Order After changing TheGPA “);

STT.inorderTraversal();

System.out.println(“The Students Gpa Avg=”+STT.gpaAvg()); //GPAAvg Method

System.out.println(“=============n”);

System.out.println(“n=============”);

STT.SaveTree(“MA.ser”);

System.out.println(“nThe new File Datan”);

printFile(“MA.ser”);

/* STT.insertNode(S2);

STT.insertNode(S3);

STT.insertNode(S1);

STT.insertNode(S4);

STT.insertNode(S5);

STT.insertNode(S6);

STT.insertNode(S7);

*/

}

}

AND I NEED TO DO THE FOLLOWING

1. Create a GUI with two button (load and save ) and a  textfield , feel free to pick any suitable colors foryour GUI
components.:

Enable the user (by clicking “Load..” buttons) toselect a binary file with student objects
using a JFileChooser. Make sure to restrict the user to selectsonly binary files.
When user picks a file, load the data into an instance ofStudentTree. Find the
maximum quizzes average as well as average GPA and show the numberson the
GUI:

The user should be able to click “Save..” button tosave the contents of the tree on
another binary file using JFileChooser.
Make sure to handle all exceptions your code might have in anoptimal way. Show
error dialogs to tell the user about anything went wrong.
2. Write a report that contains the following:
a. Introduction
b. Problem Definition
c. Design (using UML class diagrams)
d. Exceptions Used
e. Testing
f. Team Member’s Responsibilities
g. Problems Faced (and how were overcome).
and submit it with the complete source code.

(in java programming language )

. . .

Coursehelp

(Solved) : Code Python 30 2 Program Description Write Program Display Final Receipt Customer Order De Q27528236 . . .

Code in python 3.0

2. Program Description: Write a program thatwill display a final receipt for a customer order at DeliciousDonut Shoppe. The customer can keep entering amounts for each ofthe following menu items they select:

Enter 1 for Donut

Enter 2 for Milk

Enter 3 for Coffee

The price for Donuts = \$1.25

The price for Milk = \$1.00

The price for Coffee = \$1.50

Tax = \$.06

The program will keep track of how many they order of each itemand the total price for each item and the total order price. Youwill use a python while loop that will keeplooping until the customer types in yes.

Results from running Python Code:

Enter 1 for Donut

Enter 2 for Milk

Enter 3 for Coffee

Enter yes to End

Enter food option now ->1

Enter the number of donuts you would like to order ->5

Enter 1 for Donut

Enter 2 for Milk

Enter 3 for Coffee

Enter yes to End

Enter food option now ->2

Enter the number of milks you would like to order ->6

Enter 1 for Donut

Enter 2 for Milk

Enter 3 for Coffee

Enter yes to End

Enter food option now ->3

Enter the number of Coffees you would like to order ->7

Enter 1 for Donut

Enter 2 for Milk

Enter 3 for Coffee

Enter yes to End

Enter food option now ->yes

*** Delicious Donut Shoppe Receipt ***

5 donuts:       \$ 6.25

6 milks:          \$6.00

7 coffees:      \$ 10.50

Total:            \$ 24.11

. . .

Coursehelp

(Solved) : Code Python Even Asking Q31712408 . . .

How do I code this in Python? What is it even asking?

Eratosthenes (276-195 BC) was a Greek mathematician, geographer, poet, astronomer and music theorist. He was a man of learning, becoming the chief librarian at the Library of Alexandria. He invented the discipline of gcography, including the terminology used today He is best known for being the first person to calculate the circumference of the Earth, which he did by comparing altitudes of the mid-day sun at two places a known North-South distance apart. His calculation was remarkably accurate. He was also the first to calculate the tilt of the Earth’s axis (again with remarkable accuracy). Additionally, he may have accurately calculated the distance from the Earth to the Sun and invented the leap day. He created the first map of the world, incorporating parallels and meridians based on the available geographic knowledge of his era. Eratosthenes was the founder of scientific chronology; he endeavored to revise the dates of the chief literary and political events from the conquest of Troy. Eratosthenes dated The Sack of Troy to 1183 BC. In number theory, he introduce a scheme whose pseudocode is as below. Convert this to Python and explain (line by line) what each line of your code does. Run it for different n up to n 1000. Input: an integer n> 1. Let A be an array of Boolean values, indexed by integers 2 to n initially all set to true. fori 2,3,4,.., not exceeding vn: if Ali] is true for j i**2 , i** 2+i, i* *2+2, i**2+31, , not exceeding n: AU1 false. Show transcribed image text

. . .

Coursehelp

(Solved) : Code Python Itis Part Tsp Problem Checking Order Pick Two Cities Proposing New Move Improv Q26164397 . . .

This code is in Python, itis part of a TSP problem is forchecking that in order to pick two cities for proposing a new move(improvement with simulated annealing) it is better to use move1instead of move2 because the first gives couples from a uniformdistribution while the second does not.

I don’t understand what the function destructure (in bold) does.Please explain it to me.

import numpy as np
import matplotlib.pyplot as plt

def move1(n):
while True:
i =np.random.randint(n)
j =np.random.randint(n)
if i > j:
i, j = j, i
break
return i,j

def move2(n, sample_size=10**2):
for i in range(sample_size):
i =np.random.randint(n-1)
j =np.random.randint(i+1, n)
return i,j

def destructure(moves):
mi = [x[0] for x in moves]
mj = [x[1] for x in moves]
return mi, mj

def test_moves(n=10, sample_size=10**2):
t1 = [move1(n) for k inrange(sample_size)]
t2 = [move2(n) for k in range(sample_size)]

t1i, t1j = destructure(t1)
t2i, t2j = destructure(t2)

# plot the i’s
plt.clf()   # note: clf() is betterthan cla() since we’re using subplots
#       at the end (see below).
plt.title(“historgram of the i values”)
plt.hist(t1i, bins=n-1, histtype=’step’,label=’move1′)
plt.hist(t2i, bins=n-1, histtype=’step’,label=’move2′)
plt.legend(loc=’upper right’)
plt.pause(2)

#    # plot the j’s
#    plt.clf()
#    plt.title(“historgram of the j values”)
#    plt.hist(t1j, bins=n-1, histtype=’step’,label=’move1′)
#    plt.hist(t2j, bins=n-1, histtype=’step’,label=’move2′)
#    plt.legend(loc=’upper left’)
#    plt.pause(2)
#
#    # 2-d plots, first move1 then move2
#    plt.clf()
#    plt.title(“move1 histogram”)
#    plt.hist2d(t1i, t1j, bins=(n-1, n-1))
#    plt.pause(2)
#    plt.title(“move2 histogram”)
#    plt.hist2d(t2i, t2j, bins=(n-1, n-1))
#    plt.pause(2)

# same as above, both plots at once
plt.clf()
plt.subplot(211)
plt.title(“move1 vs move 2 histogram”)
plt.hist2d(t1i, t1j, bins=(n-1, n-1))
plt.subplot(212)
plt.hist2d(t2i, t2j, bins=(n-1, n-1))
plt.pause(2)

. . .

Coursehelp

(Solved) : Code Question Timer1h Library Question Basically Asking Cases Trigger Pins Q28780162 . . .

This is the code for the question:

Timer1.h is a library.

the question is basically asking when the cases trigger thepins

3) Fill in the Timing Diagram for the code in Part 3 of the addendum. Note there are two copies of the Timing Diagram, in case you need to start over. (12 points) Show transcribed image text

. . .

Coursehelp

(Solved) : Code Python Maze Game Need Help Creating Exit Maze See Y Supposed Exit Please Help One Que Q36283168 . . .

I have this code in python, for a maze game, and i needhelp creating a exit.

One more question, if i would like to have the maze in aseparate python file, and that’s its going to be open in the mainfile. How can i do that??

import turtlewn = turtle.Screen()wn.setup(700,700)wn.bgcolor(“black”)#create penclass Pen(turtle.Turtle): def __init__(self): turtle.Turtle.__init__(self) self.shape(“square”) self.color(“white”) self.penup() self.speed(0)class Player(turtle.Turtle): def __init__(self): turtle.Turtle.__init__(self) self.shape(“square”) self.color(“yellow”) self.penup() self.speed(0) def go_up(self): move_to_x=player.xcor() move_to_y=player.ycor() + 24 if (move_to_x,move_to_y) not in walls: self.goto(move_to_x, move_to_y) def go_down(self): move_to_x=player.xcor() move_to_y=player.ycor() – 24 if (move_to_x,move_to_y) not in walls: self.goto(move_to_x, move_to_y) def go_right(self): move_to_x=player.xcor() + 24 move_to_y=player.ycor() if (move_to_x,move_to_y) not in walls: self.goto(move_to_x, move_to_y) def go_left(self): move_to_x=player.xcor() – 24 move_to_y=player.ycor() if (move_to_x,move_to_y) not in walls: self.goto(move_to_x, move_to_y)#create Levels listlevels = [“”]#define first levellevel_1 = [“XXXXXXXXXXXXXXXXXXXXXXXXX”,”XP XXXXXXX XX”,”X XXXXXXX XXXXXX XX XX”,”X XX XXXXXX X XXX”,”X XX XXX XX”,”XXXXXX XX XXX XX”,”XXXXXX XX XXXXXX XXXXX”,”XXXXXX XX XXXX XXXXX”,”X XXX XXXX XXXXX”,”X XXX XXXXXXXXXXXXXXXXX”,”X XXXXXXXXXXXXXXX”,”X XXXXXXXX”,”XXXXXXXXXXXX XXXXX X”,”XXXXXXXXXXXXXXX XXXXX X”,”XXX XXXXXXXXXX X”,”XXX X”,”XXX XXXXXXXXXXXXX”,”XXXXXXXXXX XXXXXXXXXXXXX”,”XXXXXXXXXX X”,”XX XXXXX X”,”Y XXXXXXXXXXXXX XXXXXXX”,”XX XXXXXXXXXXXXX XXXXXXX”,”XX XXXX X”,”XXXX X”,”XXXXXXXXXXXXXXXXXXXXXXXXX”]#Add maze to mazes listlevels.append(level_1)#Create Level Setup Functiondef setup_maze(level): turtle.speed(0) for y in range(len(level)): for x in range(len(level[y])): #Get the Character at each x,y coordinate #NOTE the order of the y and x in the next line character = level[y][x] #Calculate the screen x, y coordinates screen_x = -288 + (x * 24) screen_y = 288 – (y * 24) #Check if it is an X (representing a wall) if character == “X”: pen.goto(screen_x, screen_y) pen.stamp() walls.append((screen_x,screen_y)) if character == “P”: player.goto(screen_x, screen_y)#Create class instancespen = Pen()player=Player()# Wallswalls=[]print(walls)#Set up the levelsetup_maze(levels[1])print(walls)#Keyboard Bindingwn.listen()wn.onkey(player.go_left,”Left”)wn.onkey(player.go_right,”Right”)wn.onkey(player.go_up,”Up”)wn.onkey(player.go_down,”Down”)#Turn off screen upateswn.tracer(0)#Main Game Loopwhile True: # Update Screen wn.update()

. . .

Coursehelp