This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from robot import Robot | |
import time | |
robot = Robot({"communication":{"communication_manager_type":"js"}}) | |
x = 0 | |
while True: | |
time.sleep(0.001) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items = ['pizza', 'veggie sticks', 'coffee', 'apple', 'candy bar' ] | |
prices = [150, 70, 90, 80, 75] | |
counter = 0 | |
while counter < len(items): | |
print(f' {counter + 1} {items[counter]} {prices[counter]}') | |
counter += 1 | |
done = len(items) + 1 | |
print(f' {done} ------ Choose this number if you are done ordering. ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items = ['pizza', 'veggie sticks', 'coffee', 'apple' ] | |
prices = [150, 70, 90, 80] | |
counter = 0 | |
while counter < len(items): | |
print(f' {counter + 1} {items[counter]} {prices[counter]}') | |
counter += 1 | |
choice = int(input('What food would you like to choose? ')) | |
print(f' You chose {items[choice-1]}. That costs {prices[choice-1]}. Enjoy! ') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random, time | |
while True: | |
number = random.randint(1,2) | |
guess = int(input('Guess a number. Either 1 or 2 ' )) | |
while guess != number: | |
print("nope. Sorry.") | |
guess = int(input("Try a new guess. ")) | |
print(f'Correct! The answer was {number}' ) | |
time.sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------------------------- | |
// | |
// Project: 3-Wire Rangefinder Sensing | |
// Description: This example will show all of the available commands | |
// for using the 3-Wire Rangefinder Sensor | |
// Configuration: V5 Speedbot (Drivetrain 2-motor, No Gyro) | |
// Rangefinder in 3-Wire Ports A B | |
// | |
// ---------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "vex.h" | |
using namespace vex; | |
int main() { | |
int counter = 0; | |
Brain.Screen.print(counter); | |
Drivetrain.setDriveVelocity(30, percent); | |
wait(1,seconds); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------------------------- | |
// | |
// Project: Drivetrain Moves and Turns | |
// Description: This example uses the drivetrain | |
// to drive and turn in different directions | |
// Configuration: V5 Speedbot (Drivetrain 2-motor, No Gyro) | |
// | |
// ---------------------------------------------------------------------------- | |
#include "vex.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from vexcode import * | |
def main(): | |
while True: | |
drivetrain.drive(FORWARD) | |
if down_eye.detect(GREEN): | |
drivetrain.turn_for(RIGHT, 180, DEGREES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyglet import app | |
from pyglet import clock | |
from pyglet import graphics | |
from pyglet import gl | |
from pyglet import text | |
from pyglet.window import Window | |
from pyglet.window import mouse | |
from pyglet.window import key | |
from math import sin, cos, pi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_winning_line(): | |
for row in range (0, rows): # for horizontal line win | |
for col in range (0, 4): # start with leftmost columns | |
if all([matrix[row][col] == value and value != 0 for value in matrix[row][col:col+4]] ): | |
return (col, row), (col +1, row), (col +2, row), (col +3, row) | |
transpose = list(zip(*matrix)) | |
for col in range (0, cols): # for vertical line win | |
for row in range (0, 3): # start with bottom on up | |
if all([transpose[col][row] == value and value != 0 for value in transpose[col][row:row+4]] ): | |
return (col, row), (col, row+1), (col, row+2), (col, row+3) |
NewerOlder