Month: April 2015

java maze solver

Due Date

Monday, April 20th, at 5:30pm

Important: This is an individual assignment. Please do not collaborate.

No late assignment will be accepted.

Make sure that you write every line of your code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report to the Dean’s office.

Minimal Submitted Files

You are required, but not limited, to turn in the following source files:

Assignment11.java (You do not need to modify this file.)
MazeSolver.java — complete this file.
Position.java (You do not need to modify this

java game Joust

CS 1110/1111 – Spring 2015 – Partner Projects

Partner Project 2: Game Project – Due: Wednesday, April 22, 11:00 AM

Games, in addition to being fun, are also a great way to practice many aspects of programming. This semester we’ll create a game similar to the 1982 classic Joust. In our version we’ll have the two players be oponents instead of allies: they’ll ride giant birds and try to knock one another off their birds. You can try it either by running JoustDemo.jar or by importing into Eclipse JoustDemoProject.zip. The ask, and l keys control the birds.

You should work with one partner on this assignment. You should pick a partner in the Thursday, 2 April lab. Your partner 

CS100: Matrices solution

CS100: Matrices

Revision Date: April 16, 2015

Printable Version


Preamble

The purpose of this assignment is to give you some practice in creating and using matrices. We want to make sure students are comfortable with iteration and recursion involving matrices. In addition to the above we want to make it so students are familiar with reading in matrices from a file as well.

Task 0: Create your directories (10 points)

Create your directories with the commands

    cd
    cd cs100/labs
    mkdir lab7
    cd lab7
    mkdir month ascii maze

You should be able to just copy and paste these commands into your console. When finished you should have three directories under your lab7 directory called ascii, maze, and month.

Task 1: Generate a month for a calendar (30 points)

Move into dir

CSE 143 Computer Programming II solution

CSE 143: Computer Programming II Spring 2015

HW2: HTMLManager (due Thursday, April 16, 2015 11:30pm)

This assignment focuses on using Stack and Queue collections. Turn in the following files using

the link on the course website:

• HTMLManager.java – A class that manages the source code for a website.

You will need the support files HTMLTag.java, HTMLTagType.java, HTMLParser.java, and HTML-
Main.java, and cse143.util from the resources button on the course website; place these in the same

folder as your program or project. You should not modify the provided files. The code you submit must

work properly with the unmodified versions.

Although this assignment relates to websites and HTML, you will not need to know how to write HTML

to complete the assignment.

What is HTML?

Web pages are written in a language called “Hypertext Markup Language”, or HTML. An HTML file

consists of text surrounded by markings called tags. Tags give information to the text, such as formatting

(bold, italic, etc.) or layout

QEMU: Adding a System Call

Assignment 3 CMPT-300

QEMU: Adding a System Call

Disclaimer: This assignment is adapted from a project developed by Dr. Jason Nieh at

Columbia University.

Part A:

Setup Your Linux Kernel Building Environment and add dummy

syscall(25%):

The first step is to learn how to create a virtual machine using QEMU and install a

custom kernel.

Please follow this tutorial:

http://www.sfu.ca/~rws1/cmpt-300/assignments/a3-qemu-tut.pdf

All files can be downloaded from:

http://www.sfu.ca/~rws1/cmpt-300/assignments/cmpt300-a3.zip

Part B:

Adding an advanced system call(75%):

Write a new system call in Linux. The system call you write should take one argument

(pointer to a data structure) and return various information for the process identified by

the pid in the data structure. All return information will be put into the data structure. For

the following discussion all relative paths refer to the top of your kernel source

directory linux-2.6.26.5

The prototype for your system call will be:

int prinfo(struc

CSCE614 solution supersalar

CSCE614 Computer Architecture (Spring 2015)

Homework #4 (Pseudo-Associative Cache)

(Due: Beginning of class on 4/17/2015)

Objective

This project is to help you understand how pseudo-associative (column-associative) cache works. You

will initially analyze the sensitivity of L1 caches to changes in parameters. Then you are to implement L1

data cache as pseudo-associative in SimpleScalar and compare its performance to the normal direct-
mapped L1 data cache.

System Requirement

Linux operating system is needed in order to use the pre-compiled little-endian Alpha ISA SPEC2000

binaries. Do not use Cygwin. If you don’t have any linux machine, please use linux.cs.tamu.edu with your

CS account. If you don’t have CS account, contact HelpDesk located in the first floor.

Setting up the environment and installing SimpleScalar

1. Download and Install SimpleScalar 3.0.

(1) Download simplesim-3v0e.tgz from http://www.simplescalar.com/.

(2) Untar the downloaded file.

$ tar xzvf simplesim-3v0e.tgz

(3) Read the

python Tkinter recursively tree

Implement a program that shall recursively draw a “tree” in a Tkinter Canvas.

The program shall consist of a non-resizable 500×500 px canvas in a non-resizable window and a menu bar. The menu bar shall have one pull-down menu named “Draw” with two items named “Repaint” and “Exit”.

The “Exit” menu item, when selected, shall gracefully terminate the program.

The “Repaint” menu item, when selected, shall clear the canvas and draw a recursive tree at random position growing “up” (in the direction 90°). The initial length of the stem shall be 128 px. The tree shall have the number of cascades selected uniformly at random between 3 and 7, inclusive.

One cascade of the tree of length L, growing from the position (X,Y) in the direction D, shall consist of (see the attached file):

  1. the stem represented as a black line segment of length L originating at (X,Y) and forming the angle D degrees with the horizonta axis, and
  2. two trees of length L*0.8, growing from the end of the stem in the directions

c++ virtual function 实现猜想

在C++中,最常见的多态指的是用基类指针指向一个派生类的实例,当用该指针调用一个基类中的虚函数时,实际调用的是派生类的函数实现,而不是基类函数。如果该指针指向另一个派生类实例,则调用另一个派生类的函数实现。因此,比如工厂模式返回一个实例,上层函数不需要知道实例来自哪个派生类,只需要用一个基类指针指向它,就可以直接获得需要的行为。从编译的角度来看,函数的调用地址并不是在编译阶段静态决定而是在运行阶段,动态地决定函数的调用地址。
多态是通过虚函数表实现的。当基类中用virtual关键字定义函数时,系统自动分配一个指针,指向该类的虚函数表。虚函数表中储存的是函数指针。在生成派生类的时候,会将派生类中对应的函数的地址写到虚函数表。之后,当利用基类指针调用函数时,先通过虚函数表指针找到对应的虚函数表,再通过表内储存的函数指针调用对应函数。由于函数指针指向派生类的实现,因此函数行为自然也就是派生类中定义的行为了。
Excerpt From: Yichao, Xiami, XiaoXiao & Fei Dong. “程序员面试白皮书.” iBooks. https://itun.es/us/zcOJ6.l

Growing a Mango solution

Project No.2: Growing a Mango

This project consists of two parts. The first part is to write the code for class Mango, which is designed for a Mango tree that grows and whose fruits appreciate overtime. The second part is to write the code for class MansoSim, which conducts a simulation of growing various mango trees for a number of years, and produces information as to which mango tree will be the most profitable.

For the first part, we envision that each Mango tree has information about

    what kind it is, as a String, how tall the tree is, as an int (in inches), how much a fruit sells for, as an int (in cents).

Each year the tree receives some updates. First, the price appreciates by 1 percent.

Second, the tree grows. The growth in percentage ranges uniformly between 5 percent and 15 percent. However, if the tree grows too tall, it will go beyond the reach for pickers, and so it is trimmed down. We assume that whenever the tree grows taller than 260 inches it is trimmed down to 150 inches.