Esempio n. 1
0
def main(test_user):
	cont = 1
	while cont == 1:
		print '1. Do you want movie recommendations?\n2. Do you want to write a review?\n3. Do you want to log out?'
		x = raw_input()
		if x == '1':
			cont = 0
			print 'How many movies do you want to be recommended?'
			max_reco = raw_input()
			recommend.main(test_user,int(max_reco))
		elif x == '2':
			cont = 0
			print 'Name of the movie:'
			movie = raw_input()
			print 'Write the review here:'
			rev = raw_input()
			review.main(test_user,movie,rev)
		elif x == '3':
			cont = 0
			break
		else:
			print 'Please enter the correct choice!!'
			cont = 1
Esempio n. 2
0
    a = numpy.arccos(gf.normalize(x).dot(gf.normalize(y)))
    q = "What is the angle between the following two vectors (in radians)?\n %s, %s\n" % (
        numpy.array_str(x), numpy.array_str(y))
    ua = rv.expect_float(q)
    rv.check_answer(a, ua, q, "angle")


def point_to_pointq():
    x = rv.vector3()
    y = rv.vector3()
    a = y - x
    q = "What is the vector from %s to %s?\n" % (numpy.array_str(x),
                                                 numpy.array_str(y))
    ua = rv.expect_vector(q)
    rv.check_answer(a, ua, q, "point to point")


vqtypes = {
    'r': (directionq, 'direction'),
    's': (vsumq, 'sum'),
    'm': (magnitudeq, 'magnitude'),
    'n': (normalizeq, 'normalize'),
    'd': (dot_productq, 'dot product'),
    'c': (cross_productq, 'cross product'),
    'a': (angleq, 'angle'),
    'ptp': (point_to_pointq, 'point to point'),
}

if __name__ == "__main__":
    rv.main(vqtypes)
Esempio n. 3
0
	a = cl * max((r.dot(e), 0))**p

	if ask:
		ua = rv.expect_vector(q)
		rv.check_answer(a, ua, q, "specular")
	else:
		return q, a, ()

def totalq(ask=True):
	(cr, normal, cl, ld, ed, ca) = (rv.color(), rv.direction(), rv.color(), rv.direction(), rv.direction(), rv.color())
	q = "Point p has a surface color of %s and a surface normal of %s. Given a light of color %s and direction %s, a view direction %s, and an ambient color %s, what will be p's final color, with a Phong exponent of 2?" % tuple(numpy.array_str(s) for s in (cr, normal, cl, ld, ed, ca))

	a = diffuseColor(cl, cr, ld, normal) + specularColor(cl, ld, normal, ed, 2) + ca * cr

	if ask:
		ua = rv.expect_vector(q)
		rv.check_answer(a, ua, q, "total")
	else:
		return q, a, ()

qtypes = {
	'l': (ldirq, 'light direction'),
	'n': (normalq, 'normal'),
	'd': (diffuseq, 'diffuse'),
	's': (specularq, 'specular'),
	't': (totalq, 'total color'),
}

if __name__ == "__main__":
	rv.main(qtypes)
Esempio n. 4
0
def run(win):
    win.nodelay(True)
    review.main(win)
Esempio n. 5
0
import playtop
import danmu
import review
import pgc

playtop.topm()
pgc.topm()
danmu.main(3)  #固定视频
danmu.main(2)  #日榜
review.main()