How to use next_step method in autotest

Best Python code snippet using autotest_python

evolution.py

Source: evolution.py Github

copy

Full Screen

1#!/​usr/​bin/​python2# -*- coding:UTF-8 -*-3import random4from Tkinter import *5from battle import *6from tkMessageBox import *7def move_char_judage(key_press):8 '定义 输入 --- 移动 的对应关系'9 if key_press == 'w' or key_press == 'W':10 move_step = [-1, 0]11 elif key_press == 's' or key_press == 'S':12 move_step = [1, 0]13 elif key_press == 'a' or key_press == 'A':14 move_step = [0, -1]15 elif key_press == 'd' or key_press == 'D': 16 move_step = [0, 1]17 else:18 move_step = [0, 0]19 return move_step20def find_hero(map_data):21 '确定英雄的位置'22 hero_pos = [0,0]23 for search_width in range(len(map_data)):24 for search_length in range(len(map_data[0])):25 if map_data[search_width][search_length] == -1:26 hero_pos[0] = search_width27 hero_pos[1] = search_length28 return hero_pos29def cat_next_block(map_data, key_press):30 '获取下一个方格的坐标'31 hero_pos = find_hero(map_data)32 hero_move = move_char_judage(key_press)33 next_step = hero_pos34 next_step = [hero_pos[0]+hero_move[0], hero_pos[1]+hero_move[1]]35 return next_step36def jud_go(map_data, key_press):37 '判断下一个方格是否能走'38 hero_pos = find_hero(map_data)39 next_step = cat_next_block(map_data, key_press)40 if map_data[next_step[0]][next_step[1]] == 1: #如果前方是石块41 move_def = 142 elif map_data[next_step[0]][next_step[1]] == 99:43 move_def = 9944 elif next_step[0]>len(map_data)-2 \45 or (next_step[1]>len(map_data[0])-2 \46 or next_step[0]<0 \47 or next_step[1]<0): #如果已到达边界48 move_def = -149 else:50 move_def = 051 return move_def52def update_map_data(hero_property, map_data, key_press):53 hero_pos = find_hero(map_data)54 next_step = cat_next_block(map_data, key_press)55 56 move_define = jud_go(map_data, key_press)57 58 if move_define == 0:59 map_data[hero_pos[0]][hero_pos[1]] = 060 map_data[next_step[0]][next_step[1]] = -1 #走过的位置变为普通方块,下一位置变为英雄所在位置61 elif move_define == 1 and hero_property['rock_destory']:62 map_data[hero_pos[0]][hero_pos[1]] = 063 map_data[next_step[0]][next_step[1]] = -164 return map_data65def block_activity(root, hero_property, map_data, key_press, difficulty):66 '在普通方块上, 随机生成怪物'67 next_step = cat_next_block(map_data, key_press)68 next_element = map_data[next_step[0]][next_step[1]]69 re_property = hero_property70 71 jud_continue = 072 if next_element == 1:73 if askyesno("讨厌的石头",'是否要打破石头'):74 hero_property['rock_destory'] = True75 re_property = battle_creat(root, hero_property, difficulty, 1)76 elif next_element == 2:77 re_property = heal_hero(hero_property, difficulty)78 elif next_element == 3:79 re_property = battle_creat(root, hero_property, difficulty,3)80 elif next_element == 98:81 re_property = find_key(hero_property)82 elif next_element == 99: 83 if hero_property['key'] == 'FOUND!':84 if level_clear(hero_property):85 jud_continue = 186 else:87 jud_continue = -188 else:89 showinfo(title = '门锁', message = '您还没有钥匙, 钥匙会随机出现在营地(橙色方块)当中')90 else:91 if random.random() < 0.15 * difficulty:92 re_property = battle_creat(root, hero_property, difficulty, 0)93 return jud_continue, re_property94def level_clear(hero_property):95 if hero_property['esp'] > 10:96 showinfo(title = '成就', message = hero_property['name']+'一局中逃跑超过十次, 获得“以无招胜有招”的称号...')97 if hero_property['esp'] == 0:98 showinfo(title = '成就', message = hero_property['name']+'一局中从未逃跑一局, 获得“不怂,就是干!”的称号...')99 choice_continue = askyesno("Skyround",'是否继续探索下一区域')...

Full Screen

Full Screen

1.0.py

Source: 1.0.py Github

copy

Full Screen

1def preparation(x_1, x_2):2 for i in x_1:3 y_1 = i4 y_2 = i5 y_3 = i6 y = [y_1, y_2, y_3]7 x_2.append(y)8def step(initial, final):9 for j in initial:10 primordial = j[0]11 going = j[1]12 check = j[2]13 if primordial not in next_step:14 if going % (2**n) == 0:15 going = going /​/​ (2**n)16 check = check /​ (2**n)17 if primordial < check:18 next_step.append(primordial)19 elif going % 2 == 1:20 going = 3*going+121 check = 3*check+122 while going > 10**n:23 going = going - 10**n24 y = [primordial, going, check]25 final.append(y)26 elif going % 2 == 0:27 going = going/​/​228 check = check/​229 if primordial < check:30 y = [primordial, going, check]31 final.append(y)32 going = going+((10**n)/​2)33 while going > 10 ** n:34 going = going - 10 ** n35 y = [primordial, going, check]36 final.append(y)37next_step = []38n = 139zero = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]40numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]41initial = []42preparation(zero, initial)43final = []44for i in range(1, 100):45 step(initial, final)46 initial = final47 final = []48print(len(next_step), next_step)49zero = []50for i in numbers:51 for j in next_step:52 y = j + i*(10**n)53 zero.append(y)54n = 255next_step = []56initial = []57preparation(zero, initial)58final = []59for i in range(1, 100):60 step(initial, final)61 initial = final62 final = []63print(len(next_step), next_step)64zero = []65for i in numbers:66 for j in next_step:67 y = j + i*(10**n)68 zero.append(y)69n = 370next_step = []71initial = []72preparation(zero, initial)73final = []74for i in range(1, 100):75 step(initial, final)76 initial = final77 final = []78print(len(next_step), next_step)79zero = []80for i in numbers:81 for j in next_step:82 y = j + i*(10**n)83 zero.append(y)84n = 485next_step = []86initial = []87preparation(zero, initial)88final = []89for i in range(1, 100):90 step(initial, final)91 initial = final92 final = []93print(len(next_step), next_step)94zero = []95for i in numbers:96 for j in next_step:97 y = j + i*(10**n)98 zero.append(y)99n = 5100next_step = []101initial = []102preparation(zero, initial)103final = []104for i in range(1, 100):105 step(initial, final)106 initial = final107 final = []...

Full Screen

Full Screen

rs_model_test.py

Source: rs_model_test.py Github

copy

Full Screen

1import math2import pytest3from src import rs_model4@pytest.fixture()5def model():6 return rs_model.RSModel()7@pytest.fixture()8def zero_pos():9 return [0.0, 0.0, 0.0]10def test_step_straight(model, zero_pos):11 next_step = model.step(zero_pos, 0.0, 1.0)12 assert next_step == (1.0, 0.0, 0.0)13def test_step_straight_with_turn(model, zero_pos):14 next_step = model.step(zero_pos, 1.0, 1.0)15 assert next_step == (1.0, 0.0, 1.0)16def test_step_turn_with_turn(model, zero_pos):17 next_step = model.step(zero_pos, 1.0, math.pi/​8)18 assert next_step[0] == 1.0 and next_step[1] == 0.019 current_yaw = next_step[2]20 next_step = model.step(next_step, 1.0, math.pi/​8)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful