def saberpaso(user): txt=open(str(user)+'.txt','r') lineas=txt.readline() print "La ultima consulta realizada fue en la leccion :"+str(lineas) txt.close() if lineas == '' : intro.intro(user) else: continu(user)
def main(): confirmation = "no" while confirmation == "no" or confirmation == "n": intro.intro() confirmation = input( "\nDo you confirm your order? ('no' or 'n' 'to re-enter your order details): \n>>> " ).lower() print( "You're order is all set now. Kindly wait as we prepare your order in afew mins." ) print("\nThank you for choosing us. Bon Apetite!")
def data_collector(sample_id, sample_type, report_type, doc_type, req): if doc_type == 'html': #do stuff if req == "intro": return intro(sample_id, sample_type) if req == "name": return name_collector(sample_id, sample_type) if req == "gene": return feature_gene(sample_id, sample_type) if req == "stem-loop": return feature_stem_loop(sample_id, sample_type) if req == "peptide": return feature_peptide(sample_id, sample_type) if req == "cds": return feature_cds(sample_id, sample_type) if req == "source": return feature_source(sample_id, sample_type) if req == "comment": return comment(sample_id, sample_type) if req == "sequence": return chain_sequence(sample_id, sample_type) if req == "all": return soup_collector(sample_id, sample_type).text else: print('Invalid parameter supplied!') else: url = "https://www.ncbi.nlm.nih.gov/sviewer/viewer.fcgi?id=" + sample_id + "&db=" + sample_type + "&report=" + report_type + "&extrafeat=null&conwithfeat=on&retmode=" + doc_type + "&tool=portal&maxdownloadsize=1000000" data = requests.get(url) soup = bs(data.content, 'html.parser') for script in soup(["script", "style"]): script.decompose() return soup, url
def program(): run = True while run: book_url = books_list[randint(0, len(books_list) - 1)] print "Number of books left: " + str(len(books_list)) book = get_book_data(book_url) user = intro() mc = MarkovChain() mc.add_string(book['text']) print '"' + textify_markov(mc.generate_text(15)) + '" \n' #result = game_run(book, 0) game_run(book, user) sleep(1) option = raw_input( 'Want to run another round with a different book? Enter Y/N: \n' ).upper() while option == 'Y': books_list.remove(book_url) book_url = books_list[randint(0, len(books_list) - 1)] book = get_book_data(book_url) mc = MarkovChain() mc.add_string(book['text']) print '"' + textify_markov(mc.generate_text(15)) + '"' #result = game_run(book) game_run(book, user) option = raw_input( 'Want to run another round with different books? Enter Y/N: \n' ).upper() else: run = False print "Number of books left: " + str(len(books_list)) else: print "Ending game..." sys.exit()
def __init__(self, system, pdata, qdata = None): r''' :param system: system considered for simulation, specified using the :class:`casiopeia.system.System` class :type system: casiopeia.system.System :param pdata: values of the time-constant parameters :math:`p \in \mathbb{R}^{\text{n}_\text{p}}` :type pdata: numpy.ndarray, casadi.DMatrix :param qdata: optional, values of the time-constant controls :math:`q \in \mathbb{R}^{\text{n}_\text{q}}`; if no values are given, 0 will be used :type qdata: numpy.ndarray, casadi.DMatrix ''' intro() self.__system = inputchecks.set_system(system) self.__generate_simulation_ode(pdata, qdata) self.__generate_scaled_dae()
def __init__(self, system, pdata, qdata=None): r""" :param system: system considered for simulation, specified using the :class:`casiopeia.system.System` class :type system: casiopeia.system.System :param pdata: values of the time-constant parameters :math:`p \in \mathbb{R}^{\text{n}_\text{p}}` :type pdata: numpy.ndarray, casadi.DMatrix :param qdata: optional, values of the time-constant controls :math:`q \in \mathbb{R}^{\text{n}_\text{q}}`; if no values are given, 0 will be used :type qdata: numpy.ndarray, casadi.DMatrix """ intro() self.__system = inputchecks.set_system(system) self.__generate_simulation_ode(pdata, qdata) self.__generate_scaled_dae()
def menu(myWin, N, test_num): result = [] #インスタンスを作成 test = tests.Test(myWin, N) if test_num == 1: line1 = u'実験1:単純反応' elif test_num == 2: line1 = u'実験2:物理的照合' elif test_num == 3: line1 = u'実験3:名称称号' elif test_num == 4: line1 = u'実験4:カテゴリ照合' msg = visual.TextStim(myWin, font = 'ヒラギノ角ゴシック W5', color = 'Black'\ , alignHoriz = 'left', alignVert = 'top') msg.setText(line1 + u'\n\n実験に進む場合は1を,説明を表示するには2を, \ \n実験選択に戻るにはqを入力してください.\ \n\n1:実験開始\n\n2:イントロ\n\nq:実験選択に戻る') msg.pos = (-0.7, 0.7) event.clearEvents() while True: msg.draw() myWin.flip() key = event.getKeys() if '1' in key: if test_num == 1: result = test.test1(0, test_num) else: result = test.test2(0, test_num) break elif '2' in key: tmp = intro.intro(myWin, N, test_num) if tmp == 0: if test_num == 1: result = test.test1(0, test_num) else: result = test.test2(0, test_num) break elif 'q' in key: return return result
def game_loop(): ''' Main game loop ''' # Beginning Values fuel = 30 food = 40 power = 10 hull = 6 crew = 10 morale = 100 distance = 25 g_dist = 20 # begin game loop running = True starting = True while running: # give introduction if this is the first round of play if starting: fuel, food, power, hull, crew, morale = i.intro( fuel, food, power, hull, crew, morale) starting = False # Display Distance h.status(distance, g_dist) # Phase 1: Production Phase fuel, food, power, hull, crew, morale = p.production_phase( fuel, food, power, hull, crew, morale) # Display Resources h.hud(fuel, food, power, hull, crew, morale) # Phase 2: Spend Phase fuel, food, power, hull, crew, morale, distance_traveled = s.spend_phase( fuel, food, power, hull, crew, morale, g_dist, distance) # Check for loss conditions if ed.lose(fuel, food, power, hull, crew, morale, g_dist): break # Phase 3: Event Phase fuel, food, power, hull, crew, morale = e.event_phase( fuel, food, power, hull, crew, morale) # Check for loss conditions if ed.lose(fuel, food, power, hull, crew, morale, g_dist): break # phase 4: Travel Phase distance, g_dist = t.travel_phase(distance, distance_traveled, g_dist) # Check for win conditions if ed.win(distance): break # Check for loss conditions if ed.lose(fuel, food, power, hull, crew, morale, g_dist): break
def main(): intro.intro() one.story_wake_up() two.chtwo() three.chthree()
for s in suspects: if s != murderer and random.choice((True, True, False)): counter = 1 while counter <= 3: tm = s.getTime() + counter - 1 if tm > 12: tm -= 12 if tm in dictItem: if counter == 1: firstOne = dictItem[tm] else: if dictItem[tm] == firstOne: dictItem[tm] = routine.leaveItem(s) counter += 1 intro.intro(murderVictim, month, day, murderWeapon, murderLocation, murderHour, murderTOD) while daysLeft > 0: routine.whatDo(daysLeft, suspects[0], suspects[1], suspects[2], suspects[3], mapJobs, mapQ1, mapQ2, mapArchetype, murderWeapon, murderVictim, murderer, dictItem) daysLeft -= 1 print("") print("Time's up. Who's the murderer?") print("1) " + suspects[0].getName()) print("2) " + suspects[1].getName()) print("3) " + suspects[2].getName()) print("4) " + suspects[3].getName()) print("") while True: try:
### import comp import lista.list import random import intro ### #Recoleccion y comprobacion ### letra=random.randrange(1, 31) #Letra A if letra==1: intro.intro(list_color_A, lista_marca_A) #Letra B if letra==2: intro.intro(list_color_B, lista_marca_B) #Letra C if letra==3: intro.intro(list_color_C, lista_marca_C) # ### #Final ### #Puntuacion raw_input()
def connectionMade(self): print self.factory intro(self) self.factory.clientProtocols.append(self)
def __init__(self, system, time_points, \ udata = None, qdata = None,\ ydata = None, \ pinit = None, xinit = None, \ wv = None, weps_u = None, \ discretization_method = "collocation", **kwargs): r''' :raises: AttributeError, NotImplementedError :param system: system considered for parameter estimation, specified using the :class:`casiopeia.system.System` class :type system: casiopeia.system.System :param time_points: time points :math:`t_\text{N} \in \mathbb{R}^\text{N}` used to discretize the continuous time problem. Controls will be applied at the first :math:`N-1` time points, while measurements take place at all :math:`N` time points. :type time_points: numpy.ndarray, casadi.DMatrix, list :param udata: optional, values for the time-varying controls :math:`u_\text{N} \in \mathbb{R}^{\text{n}_\text{u} \times \text{N}-1}` that can change at the switching time points; if no values are given, 0 will be used; note that the the second dimension of :math:`u_\text{N}` is :math:`N-1` and not :math:`N`, since there is no control value applied at the last time point :type udata: numpy.ndarray, casadi.DMatrix :param qdata: optional, values for the time-constant controls :math:`q_\text{N} \in \mathbb{R}^{\text{n}_\text{q}}`; if not values are given, 0 will be used :type qdata: numpy.ndarray, casadi.DMatrix :param ydata: values for the measurements at the switching time points :math:`y_\text{N} \in \mathbb{R}^{\text{n}_\text{y} \times \text{N}}` :type ydata: numpy.ndarray, casadi.DMatrix :param wv: weightings for the measurements :math:`w_\text{v} \in \mathbb{R}^{\text{n}_\text{y} \times \text{N}}` :type wv: numpy.ndarray, casadi.DMatrix :param weps_u: weightings for the input errors :math:`w_{\epsilon_\text{u}} \in \mathbb{R}^{\text{n}_{\epsilon_\text{u}}}` (only necessary if input errors are used within ``system``) :type weps_u: numpy.ndarray, casadi.DMatrix :param pinit: optional, initial guess for the values of the parameters that will be estimated :math:`p_\text{init} \in \mathbb{R}^{\text{n}_\text{p}}`; if no value is given, 0 will be used; note that a poorly or wrongly chosen initial guess can cause the estimation to fail :type pinit: numpy.ndarray, casadi.DMatrix :param xinit: optional, initial guess for the values of the states that will be estimated :math:`x_\text{init} \in \mathbb{R}^{\text{n}_\text{x} \times \text{N}}`; if no value is given, 0 will be used; note that a poorly or wrongly chosen initial guess can cause the estimation to fail :type xinit: numpy.ndarray, casadi.DMatrix :param discretization_method: optional, the method that shall be used for discretization of the continuous time problem w. r. t. the time points given in :math:`t_\text{N}`; possible values are "collocation" (default) and "multiple_shooting" :type discretization_method: str Depending on the discretization method specified in `discretization_method`, the following parameters can be used for further specification: :param collocation_scheme: optional, scheme used for setting up the collocation polynomials, possible values are `radau` (default) and `legendre` :type collocation_scheme: str :param number_of_collocation_points: optional, order of collocation polynomials :math:`d \in \mathbb{Z}` (default values is 3) :type number_of_collocation_points: int :param integrator: optional, integrator to be used with multiple shooting. See the CasADi documentation for a list of all available integrators. As a default, `cvodes` is used. :type integrator: str :param integrator_options: optional, options to be passed to the CasADi integrator used with multiple shooting (see the CasADi documentation for a list of all possible options) :type integrator_options: dict The resulting parameter estimation problem has the following form: .. math:: \begin{aligned} \text{arg}\,\underset{p, x, v, \epsilon_\text{u}}{\text{min}} & & \frac{1}{2} \| R(\cdot) \|_2^2 &\\ \text{subject to:} & & v_\text{k} + y_\text{k} - \phi(x_\text{k}, p; u_\text{k}, q) & = 0 \hspace{1cm} k = 1, \dots, N\\ & & g(x, p, \epsilon_\text{u}; u, q) & = 0 \\ \text{with:} & & \begin{pmatrix} {w_\text{v}}^T & {w_{\epsilon_\text{u}}}^T \end{pmatrix}^{^\mathbb{1}/_\mathbb{2}} \begin{pmatrix} {v} \\ {\epsilon_\text{u}} \end{pmatrix} & = R \\ \end{aligned} while :math:`g(\cdot)` contains the discretized system dynamics according to the specified discretization method. If the system is non-dynamic, it only contains the user-provided equality constraints. ''' intro() self._discretize_system( \ system, time_points, discretization_method, **kwargs) self._apply_controls_to_discretization(udata, qdata) self._set_optimization_variables() self._set_optimization_variables_initials(pinit, xinit) self._set_measurement_data(ydata) self._set_weightings(wv, weps_u) self._set_measurement_deviations() self._setup_residuals() self._setup_constraints() self._setup_objective() self._setup_nlp()
import platform from termcolor import colored import os import intro import main import subprocess opsys = platform.system() # If OS is Windows inform user of limitation if opsys == 'Windows': print colored("This was written for Unix based opperating systems, however it will still workon Windows.", 'red') print colored("You will miss some of the functionality. Running this on Linux will give you best results.", 'green') ######################### ## This is the welcome ## ######################### intro.intro() main.menu() subprocess.call("clear")
def __init__(self, system, time_points, \ uinit = None, umin = None, umax = None, \ qinit = None, qmin = None, qmax = None, \ pdata = None, x0 = None, \ xmin = None, xmax = None, \ wv = None, weps_u = None, \ discretization_method = "collocation", \ optimality_criterion = "A", **kwargs): r''' :raises: AttributeError, NotImplementedError :param system: system considered for parameter estimation, specified using the :class:`casiopeia.system.System` class :type system: casiopeia.system.System :param time_points: time points :math:`t_\text{N} \in \mathbb{R}^\text{N}` used to discretize the continuous time problem. Controls will be applied at the first :math:`N-1` time points, while measurements take place at all :math:`N` time points. :type time_points: numpy.ndarray, casadi.DMatrix, list :param umin: optional, lower bounds of the time-varying controls :math:`u_\text{min} \in \mathbb{R}^{\text{n}_\text{u}}`; if not values are given, :math:`-\infty` will be used :type umin: numpy.ndarray, casadi.DMatrix :param umax: optional, upper bounds of the time-vaying controls :math:`u_\text{max} \in \mathbb{R}^{\text{n}_\text{u}}`; if not values are given, :math:`\infty` will be used :type umax: numpy.ndarray, casadi.DMatrix :param uinit: optional, initial guess for the values of the time-varying controls :math:`u_\text{N} \in \mathbb{R}^{\text{n}_\text{u} \times \text{N}-1}` that (might) change at the switching time points; if no values are given, 0 will be used; note that a poorly or wrongly chosen initial guess can cause the optimization to fail, and note that the the second dimension of :math:`u_N` is :math:`N-1` and not :math:`N`, since there is no control value applied at the last time point :type uinit: numpy.ndarray, casadi.DMatrix :param qmin: optional, lower bounds of the time-constant controls :math:`q_\text{min} \in \mathbb{R}^{\text{n}_\text{q}}`; if not values are given, :math:`-\infty` will be used :type qmin: numpy.ndarray, casadi.DMatrix :param qmax: optional, upper bounds of the time-constant controls :math:`q_\text{max} \in \mathbb{R}^{\text{n}_\text{q}}`; if not values are given, :math:`\infty` will be used :type qmax: numpy.ndarray, casadi.DMatrix :param qinit: optional, initial guess for the optimal values of the time-constant controls :math:`q_\text{init} \in \mathbb{R}^{\text{n}_\text{q}}`; if not values are given, 0 will be used; note that a poorly or wrongly chosen initial guess can cause the optimization to fail :type qinit: numpy.ndarray, casadi.DMatrix :param pdata: values of the time-constant parameters :math:`p \in \mathbb{R}^{\text{n}_\text{p}}` :type pdata: numpy.ndarray, casadi.DMatrix :param x0: state values :math:`x_0 \in \mathbb{R}^{\text{n}_\text{x}}` at the first time point :math:`t_0` :type x0: numpy.ndarray, casadi.DMatrix, list :param xmin: optional, lower bounds of the states :math:`x_\text{min} \in \mathbb{R}^{\text{n}_\text{x}}`; if no value is given, :math:`-\infty` will be used :type xmin: numpy.ndarray, casadi.DMatrix :param xmax: optional, lower bounds of the states :math:`x_\text{max} \in \mathbb{R}^{\text{n}_\text{x}}`; if no value is given, :math:`\infty` will be used :type xmax: numpy.ndarray, casadi.DMatrix :param wv: weightings for the measurements :math:`w_\text{v} \in \mathbb{R}^{\text{n}_\text{y} \times \text{N}}` :type wv: numpy.ndarray, casadi.DMatrix :param weps_u: weightings for the input errors :math:`w_{\epsilon_\text{u}} \in \mathbb{R}^{\text{n}_{\epsilon_\text{u}}}` (only necessary if input errors are used within ``system``) :type weps_u: numpy.ndarray, casadi.DMatrix :param discretization_method: optional, the method that shall be used for discretization of the continuous time problem w. r. t. the time points given in :math:`t_\text{N}`; possible values are "collocation" (default) and "multiple_shooting" :type discretization_method: str :param optimality_criterion: optional, the information function :math:`I_\text{X}(\cdot)` to be used on the covariance matrix, possible values are `A` (default) and `D`, while .. math :: \begin{aligned} I_\text{A}(\Sigma_\text{p}) & = \frac{1}{n_\text{p}} \text{Tr}(\Sigma_\text{p}),\\ I_\text{D}(\Sigma_\text{p}) & = \begin{vmatrix} \Sigma_\text{p} \end{vmatrix} ^{\frac{1}{n_\text{p}}}, \end{aligned} for further information see e. g. [#f1]_ :type optimality_criterion: str Depending on the discretization method specified in `discretization_method`, the following parameters can be used for further specification: :param collocation_scheme: optional, scheme used for setting up the collocation polynomials, possible values are `radau` (default) and `legendre` :type collocation_scheme: str :param number_of_collocation_points: optional, order of collocation polynomials :math:`d \in \mathbb{Z}` (default values is 3) :type number_of_collocation_points: int :param integrator: optional, integrator to be used with multiple shooting. See the CasADi documentation for a list of all available integrators. As a default, `cvodes` is used. :type integrator: str :param integrator_options: optional, options to be passed to the CasADi integrator used with multiple shooting (see the CasADi documentation for a list of all possible options) :type integrator_options: dict You do not need to specify initial guesses for the estimated states, since these are obtained with a system simulation using the initial states and the provided initial guesses for the controls. The resulting optimization problem has the following form: .. math:: \begin{aligned} \text{arg}\,\underset{u, q, x}{\text{min}} & & I(\Sigma_{\text{p}}(x, u, q; p)) &\\ \text{subject to:} & & g(x, u, q; p) & = 0\\ & & u_\text{min} \leq u_\text{k} & \leq u_\text{max} \hspace{1cm} k = 1, \dots, N-1\\ & & x_\text{min} \leq x_\text{k} & \leq x_\text{max} \hspace{1cm} k = 1, \dots, N\\ & & x_1 \leq x(t_1) & \leq x_1 \end{aligned} where :math:`\Sigma_p = \text{Cov}(p)` and :math:`g(\cdot)` contains the discretized system dynamics according to the specified discretization method. If the system is non-dynamic, it only contains the user-provided equality constraints. .. rubric:: References .. [#f1] |linkf1|_ .. _linkf1: http://ginger.iwr.uni-heidelberg.de/vplan/images/5/54/Koerkel2002.pdf .. |linkf1| replace:: *Körkel, Stefan: Numerische Methoden für Optimale Versuchsplanungsprobleme bei nichtlinearen DAE-Modellen, PhD Thesis, Heidelberg university, 2002, pages 74/75.* ''' intro() self._discretize_system( \ system, time_points, discretization_method, **kwargs) self._set_parameter_guess(pdata) self._apply_parameters_to_discretization() self._set_optimization_variables() self._set_optimization_variables_initials(qinit, x0, uinit) self._set_optimization_variables_lower_bounds(umin, qmin, xmin, x0) self._set_optimization_variables_upper_bounds(umax, qmax, xmax, x0) self._set_measurement_data() self._set_weightings(wv, weps_u) self._set_measurement_deviations() self._set_cov_matrix_derivative_directions() self._setup_constraints() self._setup_gauss_newton_lagrangian_hessian() self._setup_covariance_matrix() self._setup_covariance_matrix_for_evaluation() self._set_optimiality_criterion(optimality_criterion) self._setup_objective() self._apply_parameters_to_objective() self._setup_nlp()
#!/usr/bin/env python3 from intro import intro from choose1 import prebattle from battle import * rival_name = intro() answer = 'y' while (answer == 'y'): chosen_Pokemon = prebattle(rival_name) battle([chosen_Pokemon[0]], rival_name, [chosen_Pokemon[1]]) answer = input("\nWould you like to battle again? ('y' or 'n') ") while (answer != 'n' and answer != 'y'): answer = input("That's not a valid answer. Would you like to battle again? ('y' or 'n') ") print("\nThanks for playing!")
def intro(self): i.intro(self)
controls.setConfig(c) except: controls.writeConfig('controls_bak.cfg', c) controls.setConfig(controls.defaultControls) #any fails (missing gamepad usually), default to original controls introMusic = ika.Sound('music/Existing.s3m') #while not controls.attack(): # ika.Video.DrawRect(0,0,320,240,0) # ika.Video.ShowPage() # ika.Input.Update() sound.fader.kill() #ika.Delay(5) introMusic.Play() #ika.Delay(5) intro() while True: killmusic=True if saveload.quicksave: result = 3 else: result = menu() engine = Engine() if result == 0: #New Game introMusic.Pause() sound.fader.kill() engine.beginNewGame() if killmusic:
flip=pygame.display.flip blit=screen.blit load=pygame.image.load fill=screen.fill #path list begins here title_path=resources.get_resource_path("FinalBowserCastleSMG2.ogg", "music/Areas") titlebg_path=resources.get_resource_path("SuperMarioGalaxyTitle.png", "images") #path list ends here music.load(title_path) music.set_volume(1) music.play(-1) titlebg=load(titlebg_path) fill([0,0,0]) blit(titlebg, [0,0]) flip() run=1 q=0 clear=0 if options.test:clear=1 while run: for event in pygame.event.get(): if event.type==pygame.QUIT: q=1 run=0 elif event.type==pygame.KEYDOWN: if event.key==pygame.K_x: run=0 if q:pygame.quit() if clear:resources.done() intro.intro(screen)
def game(): playAgain = "yes" while playAgain == "yes" or playAgain == "y": intro.intro() playAgain = input("Do you want to play again? (yes or y to continue playing): ")
def __init__(self): self._running = True self.size = self.width, self.height = 640, 400 self._display_surf = pygame.display.set_mode(self.size) self.intro_state = intro(self._display_surf, self.width, self.height) self.game_state = Game(self._display_surf, self.width, self.height)
import pygame, sys from intro import intro from utils import * from sprites import * from pygame.locals import * from random import randint intro() DISPLAYSURF = pygame.display.set_mode((800, 593)) pygame.display.set_caption("Kill the Baby!") background = load_image("KTBbackground2.png") BASIN = pygame.Rect((20, 391), (250, 180)) TOP_RIGHT = pygame.Rect((680, 20), (100, 100)) CENTER_RIGHT = pygame.Rect((680, 220), (100, 100)) BOTTOM_RIGHT = pygame.Rect((680, 420), (100, 100)) TOP_CENTER = pygame.Rect((560, 20), (100, 100)) CENTER = pygame.Rect((560, 220), (100, 100)) BOTTOM_CENTER = pygame.Rect((560, 420), (100, 100)) # Constants BASIN_ITEM = 0 GARLIC_ITEM = 1 STAKE_ITEM = 2 FISH_ITEM = 3 SILVER_ITEM = 4 SWATTER_ITEM = 5 RAZOR_ITEM = 6 BASE_TYPE = 0 WERE_TYPE = 1 VAMP_TYPE = 2
def __init__(self, \ u = ci.mx_sym("u", 0), \ q = ci.mx_sym("q", 0), \ p = None, \ x = ci.mx_sym("x", 0), \ eps_u = ci.mx_sym("eps_u", 0), \ phi = None, \ f = ci.mx_sym("f", 0), \ g = ci.mx_sym("g", 0)): r''' :raises: TypeError, NotImplementedError :param u: time-varying controls :math:`u \in \mathbb{R}^{\text{n}_\text{u}}` that are applied piece-wise-constant for each control intervals, and therefor can change from on interval to another, e. g. motor dutycycles, temperatures, massflows (optional) :type u: casadi.casadi.MX :param q: time-constant controls :math:`q \in \mathbb{R}^{\text{n}_\text{q}}` that are constant over time, e. g. initial mass concentrations of reactants, elevation angles (optional) :type q: casadi.casadi.MX :param p: unknown parameters :math:`p \in \mathbb{R}^{\text{n}_\text{p}}` :type p: casadi.casadi.MX :param x: differential states :math:`x \in \mathbb{R}^{\text{n}_\text{x}}` (optional) :type x: casadi.casadi.MX :param eps_u: input errors :math:`\epsilon_{u} \in \mathbb{R}^{\text{n}_{\epsilon_\text{u}}}` (optional) :type eps_u: casadi.casadi.MX :param phi: output function :math:`\phi(u, q, x, p) = y \in \mathbb{R}^{\text{n}_\text{y}}` :type phi: casadi.casadi.MX :param f: explicit system of ODEs :math:`f(u, q, x, p, \epsilon_\text{u}) = \dot{x} \in \mathbb{R}^{\text{n}_\text{x}}` (optional) :type f: casadi.casadi.MX :param g: equality constraints :math:`g(u, q, p) = 0 \in \mathbb{R}^{\text{n}_\text{g}}` (optional) :type g: casadi.casadi.MX Depending on the inputs the user provides, the :class:`System` is interpreted as follows: **Non-dynamic system** (x = None): .. math:: y = \phi(u, q, p) 0 = g(u, q, p). **Explicit ODE system** (x != None): .. math:: y & = & \phi(u, q, x, p) \\ \dot{x} & = & f(u, q, x, p, \epsilon_\text{u}). ''' intro() print('\n' + '# ' + 23 * '-' + \ ' casiopeia system definition ' + 22 * '-' + ' #') print('\nStarting system definition ...') self.u = u self.q = q self.p = p self.x = x self.eps_u = eps_u self.phi = phi self.f = f self.g = g self.__system_validation()
def makedemo(dst,addfile,cycles_per_line): cdt=mainfile(cycles_per_line) writer=screen_writer(cdt,"compress.pickle") # for i in xrange(0,256): # cdt.block(0xc000+i,1,[i]) # cdt.gap(1000) name="build/breaking_baud-%2d.exe"%(cycles_per_line) #t=gmtime() #cdt.loader(name,"BROKEN BAUD %04d-%02d-%02d"%(t.tm_year,t.tm_mon,t.tm_mday),0x8000,0x8000) cdt.loader(name,"BREAKING BAUD",0x8000,0x8000) cdt.gap(10) musicplayer ="build/arkos_player-%d.bin"%(cycles_per_line) music_block_size = 94 started = False player=cdt.get_data_as_blocks(musicplayer, player_base,music_block_size) music=cdt.get_data_as_blocks("music/hardstyle-4000.bin", 0x4000, music_block_size) play = music_switch(cdt,player,music) # send the intro sequence with music interleaved pen=True if True or not testing: idx = 0 gen=intro() for i in gen: if i <> None: print "Creating intro image %d"%idx try: i.save("build/intro-%02d.gif"%idx) except: pass writer.add("Intro %d"%idx,i,1000,False) idx = idx+1 else: if pen: cdt.exec_code("build/remove_pen1-%d.bin"%(cycles_per_line), applet_base) writer.reset("Intro %d"%idx,next(gen)) pen = False else: play.first() # interleave music play.block() # send remaining music play.first() play.load("littlesailor") cdt.gap(2000) post_intro(cdt,writer,text_base,font_base,text_out_base) #writer.present(1000) # cdt.write(dst) # writer.save() # sys.exit(0) if not testing: cdt.exec_code("build/normal_to_overscan-%d.bin"%(cycles_per_line), applet_base) play.play() for i in xrange(1,lk_images+1): #74+1, ralf:53+1, 4ab:72+1, 5: 57+1 f="sequence/lightkeeper/%02d.gif"%i print "Adding image %s"%(f) writer.add_overscan(f,Image.open(f),BLOCK_SIZE,False) if i>=54: cdt.gap(0) #4ab:70, 5:54 #writer.add(f,Image.open(f).crop((64,72,384,272))) cdt.gap(5000) #cdt.load_data("music/cr4sh-5000.bin", 0x5000) play.load("cr4sh") writer.present_overscan(0) #cdt.start_music(0x5000) play.play() cdt.gap(500) cdt.exec_code("build/overscan_to_wideonly-%d.bin"%(cycles_per_line), applet_base) if not testing: for i in xrange(1,term_images+1): #16+1 f="sequence/bin_renderin/%02d.gif"%i print "Adding image %s"%(f) writer.add_wideonly(f,Image.open(f),BLOCK_SIZE,False) cdt.gap(0) if True: cdt.gap(5000) play.load("bonito") #cdt.load_data("music/bonito-4000.bin", 0x4000) writer.present_wideonly(0) #cdt.start_music(0x4000) play.play() cdt.gap(500) cdt.exec_code("build/wideonly_to_normal-%d.bin"%(cycles_per_line), applet_base) if not testing: for i in xrange(1,rose_images+1): f="sequence/rose/%02d.gif"%i print "Adding image %s"%(f) writer.add(f,half(Image.open(f)),BLOCK_SIZE,False) cdt.gap(0) if True: cdt.gap(5000) play.load("seagulls") #cdt.load_data("music/remember david-5000.bin", 0x5000) writer.present(0) #cdt.start_music(0x5000) play.play() cdt.gap(500) # send the outtro sequence with music interleaved if True: idx = 0 outro(cdt,writer,text_base,font_base,text_out_base) cdt.gap(10000) play.load("silence") play.play() cdt.gap(1000) cdt.exec_code("build/reboot-%d.bin"%(cycles_per_line), applet_base) cdt.write(dst) writer.save()
SIZE_L = 500 SIZE_TEST = 3 TESTING = False # initialize all pygame modules pygame.init() # create display surface screen = pygame.display.set_mode((SIZE_L, SIZE_L)) # test_arr = pygame.PixelArray(screen) # test_arr[:][0] = 0xFFFFFF # test_arr.close() # pygame.display.flip() # input('test') intro(screen) # create small working surface small_screen = pygame.Surface((SIZE_S, SIZE_S)) # set inital state #cells.populate_surface(screen, small_screen) mouse.set_state(screen, small_screen) # play the game run = True while (run): for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True) local_css("./css/style.css") st.title('El coche eléctrico en Europa') st.sidebar.text('Navegación') menu = st.sidebar.selectbox('Menu:', options=['Intro', 'Contaminación', 'Ventas', 'Conclusiones']) config = {'displayModeBar': False} if menu == 'Intro': intro.intro() # st.sidebar.button("Hablemos de contaminacion") elif menu == 'Contaminación': pollution.pollution(config) elif menu == 'Ventas': sales.sales(config) elif menu == 'Conclusiones': conclusion.conclusion() else: intro.intro()
import pygame from intro import intro from board import start from board import board if __name__ == "__main__":#whenever you run this file by actually running it ;) intro()#calls into from intro .py score = start(1 , 3, 0) #start level1 from board.py start(level_number , life_given , initial_coins)
def makedemo(dst, addfile, cycles_per_line): cdt = mainfile(cycles_per_line) writer = screen_writer(cdt, "compress.pickle") # for i in xrange(0,256): # cdt.block(0xc000+i,1,[i]) # cdt.gap(1000) name = "build/breaking_baud-%2d.exe" % (cycles_per_line) #t=gmtime() #cdt.loader(name,"BROKEN BAUD %04d-%02d-%02d"%(t.tm_year,t.tm_mon,t.tm_mday),0x8000,0x8000) cdt.loader(name, "BREAKING BAUD", 0x8000, 0x8000) cdt.gap(10) musicplayer = "build/arkos_player-%d.bin" % (cycles_per_line) music_block_size = 94 started = False player = cdt.get_data_as_blocks(musicplayer, player_base, music_block_size) music = cdt.get_data_as_blocks("music/hardstyle-4000.bin", 0x4000, music_block_size) play = music_switch(cdt, player, music) # send the intro sequence with music interleaved pen = True if True or not testing: idx = 0 gen = intro() for i in gen: if i <> None: print "Creating intro image %d" % idx try: i.save("build/intro-%02d.gif" % idx) except: pass writer.add("Intro %d" % idx, i, 1000, False) idx = idx + 1 else: if pen: cdt.exec_code( "build/remove_pen1-%d.bin" % (cycles_per_line), applet_base) writer.reset("Intro %d" % idx, next(gen)) pen = False else: play.first() # interleave music play.block() # send remaining music play.first() play.load("littlesailor") cdt.gap(2000) post_intro(cdt, writer, text_base, font_base, text_out_base) #writer.present(1000) # cdt.write(dst) # writer.save() # sys.exit(0) if not testing: cdt.exec_code("build/normal_to_overscan-%d.bin" % (cycles_per_line), applet_base) play.play() for i in xrange(1, lk_images + 1): #74+1, ralf:53+1, 4ab:72+1, 5: 57+1 f = "sequence/lightkeeper/%02d.gif" % i print "Adding image %s" % (f) writer.add_overscan(f, Image.open(f), BLOCK_SIZE, False) if i >= 54: cdt.gap(0) #4ab:70, 5:54 #writer.add(f,Image.open(f).crop((64,72,384,272))) cdt.gap(5000) #cdt.load_data("music/cr4sh-5000.bin", 0x5000) play.load("cr4sh") writer.present_overscan(0) #cdt.start_music(0x5000) play.play() cdt.gap(500) cdt.exec_code("build/overscan_to_wideonly-%d.bin" % (cycles_per_line), applet_base) if not testing: for i in xrange(1, term_images + 1): #16+1 f = "sequence/bin_renderin/%02d.gif" % i print "Adding image %s" % (f) writer.add_wideonly(f, Image.open(f), BLOCK_SIZE, False) cdt.gap(0) if True: cdt.gap(5000) play.load("bonito") #cdt.load_data("music/bonito-4000.bin", 0x4000) writer.present_wideonly(0) #cdt.start_music(0x4000) play.play() cdt.gap(500) cdt.exec_code( "build/wideonly_to_normal-%d.bin" % (cycles_per_line), applet_base) if not testing: for i in xrange(1, rose_images + 1): f = "sequence/rose/%02d.gif" % i print "Adding image %s" % (f) writer.add(f, half(Image.open(f)), BLOCK_SIZE, False) cdt.gap(0) if True: cdt.gap(5000) play.load("seagulls") #cdt.load_data("music/remember david-5000.bin", 0x5000) writer.present(0) #cdt.start_music(0x5000) play.play() cdt.gap(500) # send the outtro sequence with music interleaved if True: idx = 0 outro(cdt, writer, text_base, font_base, text_out_base) cdt.gap(10000) play.load("silence") play.play() cdt.gap(1000) cdt.exec_code("build/reboot-%d.bin" % (cycles_per_line), applet_base) cdt.write(dst) writer.save()
from intro import intro from input_parser import input_parser from compressor import compressor from printer import printer from robo_browser import robo_browser from misc_data import ListAlbum # This is what runs the program. It calls multiple methods from different files to do so. user_object = intro() album_list = ListAlbum() input_parser(user_object, album_list) album_object = compressor(album_list) printer(album_object) robo_browser(album_object, user_object)