The document provides instructions for programming simple games using a Raspberry Pi and Python. It outlines coding a dice game and a Pass the Pigs game as examples. For the dice game, it defines a function to roll two dice with random numbers and output the total. For Pass the Pigs, it defines a function to roll two dice, output the result and assign points based on the numbers rolled, breaking if a Pig Out or Oinker is rolled. The document guides writing the code, testing it, and executing the Python scripts.
Minha primeira apresentação sobre Elixir, para o evento Dev In Santos. As coisas essenciais que diferenciam Elixir de qualquer outra nova linguagem. Primeira palestra que eu subo com as anotações também (muito vídeo). #FullMetalAlchemist
QConSP 2015 - Dicas de Performance para Aplicações WebFabio Akita
Antes de pensar em "vamos reescrever tudo na linguagem mais rápida da moda que tudo vai dar certo". Na verdade pra quase todas as aplicações Web, antes veja se você segue este checklist mínimo de 9 dicas. Você vai ver que a maioria não segue esse mínimo antes, e deveria.
Minha primeira apresentação sobre Elixir, para o evento Dev In Santos. As coisas essenciais que diferenciam Elixir de qualquer outra nova linguagem. Primeira palestra que eu subo com as anotações também (muito vídeo). #FullMetalAlchemist
QConSP 2015 - Dicas de Performance para Aplicações WebFabio Akita
Antes de pensar em "vamos reescrever tudo na linguagem mais rápida da moda que tudo vai dar certo". Na verdade pra quase todas as aplicações Web, antes veja se você segue este checklist mínimo de 9 dicas. Você vai ver que a maioria não segue esse mínimo antes, e deveria.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on PyGame Tutorial covers all the basic aspects of creating and running your own simple game. It establishes the concepts needed like images, sounds, geometry etc needed to build your own games using Python. Below is the agenda of this PPT:
What is PyGame?
Installing PyGame
Anatomy of PyGame
Working with Images
Working with Sounds
Working with Geometric Drawings
Working with Fonts and Text
Understanding Input Methods
Understanding Scene Logic
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Hug presentation for android tech talks #14Artur Staniec
15 minutes presentation I gave about hug. Hug is the http library that simplifies request handling to the minimum, which makes it great tool for mobile developers that aren't familiar with any complex frameworks. In the same time it provides a lot of useful features. Presumably so much that you won't need to look elsewhere.
Core Audio in iOS 6 (CocoaConf Chicago, March 2013)Chris Adamson
Core Audio gets a bunch of neat new tricks in iOS 6, particularly for developers working with Audio Units. New effect units include an improved ability to vary pitch and playback speed, a digital delay unit, and OS X's powerful matrix mixer. There's now a new place to use units too, as the Audio Queue now offers developers a way to "tap" into the data being queued up for playback. To top it all off, a new "multi-route" system allows us to play out of multiple, multi-channel output devices at the same time.
Want to see, and hear, how all this stuff works? This section is the place to find out.
This is a lightning 5-minute talk given SyncHerts in Stevenage UK on 14 Jan 2016. It very quickly tells you what the 2600 can do, shows how we get something on the screen, and how we must count every single clock cycle to make our code work! Finally, we delve into *why* someone might want to try this..
Project by: Vishruth Khare (CO393) , Vishwas Agarwal (CO395)
Submitted to: Ms. Chingmuankim Naulak
Subject: Computer Graphics (CO-313)
About: The game is a side-scroller where the player controls a bird, attempting to fly between rows of green pipes, which are equally sized gaps placed at random heights, without coming into contacting them. Each successful pass through a pair of pipes awards the player one point. If the player touches the pipes, it ends the game. The bird briefly flaps upward each time the player taps the key; if the key is not tapped, the bird falls due to gravity. The player is awarded several milestones, such as a bronze medal if they reached twenty points, a silver medal from Forty points, a gold medal from Fifty, and a platinum medal from Hundred points. The achievements get stored in the collectable haul.
Compatibility: Any system with Love2D framework installed can compile, execute and play this game.
This presentation is on advanced debugging using Java bytecodes (presented in Core Java meetup on 1st October in Accion Labs). If you are a Java developer and are interested in knowing advanced debugging techniques or understanding bytecodes, this presentation is for you.
Python is an interpreted, object-oriented programming language.
In this part, I have gone through some basics of python, game theory, and have created tic tac toe game
Using the code below- I need help with creating code for the following.pdfacteleshoppe
Using the code below, I need help with creating code for the following:
1) Write Python code to plot the images from the first epoch. Take a screenshot of the images
from the first epoch.
2) Write Python code to plot the images from the last epoch. Take a screenshot of the images
from the last epoch.
#Step 1: Import the required Python libraries:
import numpy as np
import matplotlib.pyplot as plt
import keras
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.models import Sequential, Model
from keras.optimizers import Adam,SGD
from keras.datasets import cifar10
#Step 2: Load the data.
#Loading the CIFAR10 data
(X, y), (_, _) = keras.datasets.cifar10.load_data()
#Selecting a single class of images
#The number was randomly chosen and any number
#between 1 and 10 can be chosen
X = X[y.flatten() == 8]
#Step 3: Define parameters to be used in later processes.
#Defining the Input shape
image_shape = (32, 32, 3)
latent_dimensions = 100
#Step 4: Define a utility function to build the generator.
def build_generator():
model = Sequential()
#Building the input layer
model.add(Dense(128 * 8 * 8, activation="relu",
input_dim=latent_dimensions))
model.add(Reshape((8, 8, 128)))
model.add(UpSampling2D())
model.add(Conv2D(128, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(UpSampling2D())
model.add(Conv2D(64, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(Conv2D(3, kernel_size=3, padding="same"))
model.add(Activation("tanh"))
#Generating the output image
noise = Input(shape=(latent_dimensions,))
image = model(noise)
return Model(noise, image)
#Step 5: Define a utility function to build the discriminator.
def build_discriminator():
#Building the convolutional layers
#to classify whether an image is real or fake
model = Sequential()
model.add(Conv2D(32, kernel_size=3, strides=2,
input_shape=image_shape, padding="same"))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(64, kernel_size=3, strides=2, padding="same"))
model.add(ZeroPadding2D(padding=((0,1),(0,1))))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
model.add(Conv2D(128, kernel_size=3, strides=2, padding="same"))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(256, kernel_size=3, strides=1, padding="same"))
model.add(BatchNormalization(momentum=0.8))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
#Building the output layer
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
image = Input(shape=image_shape)
validity = model(image)
return Model(image, validity)
#Step 6: Define a utility function to display th.
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
The Raspberry Pi is a small credit-card sized linux computer. Developers and hobbyists around the world are creating miraculous applications and projects, and now you can join them. Last year we presented Raspberry Pi, What We Have Learned So Far, This year's presentation covers the first steps to using your Pi. From the basics, like burning your SD Card to creating a News Reader, you will learn GPIO Basics and simple Python tools. Communication between other components using SPI or I2C will also be covered. It is recommended, but not required that you have a Raspberry Pi, some knowledge of Python and simple electronics.
Initially created for the Python User Group Freiburg meeting on December 11, 2013. Last updated November 2014.
Source, including codesamples, available at https://github.com/Felix11H/LaTeX-presentations-pygame_intro
An introduction to exploit development.
I gave this talk at Hack the North 2014, and most of this information is pulled out of classics like Smashing the Stack for Fun and Profit, so there shouldn't be anything novel in here.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on PyGame Tutorial covers all the basic aspects of creating and running your own simple game. It establishes the concepts needed like images, sounds, geometry etc needed to build your own games using Python. Below is the agenda of this PPT:
What is PyGame?
Installing PyGame
Anatomy of PyGame
Working with Images
Working with Sounds
Working with Geometric Drawings
Working with Fonts and Text
Understanding Input Methods
Understanding Scene Logic
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Hug presentation for android tech talks #14Artur Staniec
15 minutes presentation I gave about hug. Hug is the http library that simplifies request handling to the minimum, which makes it great tool for mobile developers that aren't familiar with any complex frameworks. In the same time it provides a lot of useful features. Presumably so much that you won't need to look elsewhere.
Core Audio in iOS 6 (CocoaConf Chicago, March 2013)Chris Adamson
Core Audio gets a bunch of neat new tricks in iOS 6, particularly for developers working with Audio Units. New effect units include an improved ability to vary pitch and playback speed, a digital delay unit, and OS X's powerful matrix mixer. There's now a new place to use units too, as the Audio Queue now offers developers a way to "tap" into the data being queued up for playback. To top it all off, a new "multi-route" system allows us to play out of multiple, multi-channel output devices at the same time.
Want to see, and hear, how all this stuff works? This section is the place to find out.
This is a lightning 5-minute talk given SyncHerts in Stevenage UK on 14 Jan 2016. It very quickly tells you what the 2600 can do, shows how we get something on the screen, and how we must count every single clock cycle to make our code work! Finally, we delve into *why* someone might want to try this..
Project by: Vishruth Khare (CO393) , Vishwas Agarwal (CO395)
Submitted to: Ms. Chingmuankim Naulak
Subject: Computer Graphics (CO-313)
About: The game is a side-scroller where the player controls a bird, attempting to fly between rows of green pipes, which are equally sized gaps placed at random heights, without coming into contacting them. Each successful pass through a pair of pipes awards the player one point. If the player touches the pipes, it ends the game. The bird briefly flaps upward each time the player taps the key; if the key is not tapped, the bird falls due to gravity. The player is awarded several milestones, such as a bronze medal if they reached twenty points, a silver medal from Forty points, a gold medal from Fifty, and a platinum medal from Hundred points. The achievements get stored in the collectable haul.
Compatibility: Any system with Love2D framework installed can compile, execute and play this game.
This presentation is on advanced debugging using Java bytecodes (presented in Core Java meetup on 1st October in Accion Labs). If you are a Java developer and are interested in knowing advanced debugging techniques or understanding bytecodes, this presentation is for you.
Python is an interpreted, object-oriented programming language.
In this part, I have gone through some basics of python, game theory, and have created tic tac toe game
Using the code below- I need help with creating code for the following.pdfacteleshoppe
Using the code below, I need help with creating code for the following:
1) Write Python code to plot the images from the first epoch. Take a screenshot of the images
from the first epoch.
2) Write Python code to plot the images from the last epoch. Take a screenshot of the images
from the last epoch.
#Step 1: Import the required Python libraries:
import numpy as np
import matplotlib.pyplot as plt
import keras
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.models import Sequential, Model
from keras.optimizers import Adam,SGD
from keras.datasets import cifar10
#Step 2: Load the data.
#Loading the CIFAR10 data
(X, y), (_, _) = keras.datasets.cifar10.load_data()
#Selecting a single class of images
#The number was randomly chosen and any number
#between 1 and 10 can be chosen
X = X[y.flatten() == 8]
#Step 3: Define parameters to be used in later processes.
#Defining the Input shape
image_shape = (32, 32, 3)
latent_dimensions = 100
#Step 4: Define a utility function to build the generator.
def build_generator():
model = Sequential()
#Building the input layer
model.add(Dense(128 * 8 * 8, activation="relu",
input_dim=latent_dimensions))
model.add(Reshape((8, 8, 128)))
model.add(UpSampling2D())
model.add(Conv2D(128, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(UpSampling2D())
model.add(Conv2D(64, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(Conv2D(3, kernel_size=3, padding="same"))
model.add(Activation("tanh"))
#Generating the output image
noise = Input(shape=(latent_dimensions,))
image = model(noise)
return Model(noise, image)
#Step 5: Define a utility function to build the discriminator.
def build_discriminator():
#Building the convolutional layers
#to classify whether an image is real or fake
model = Sequential()
model.add(Conv2D(32, kernel_size=3, strides=2,
input_shape=image_shape, padding="same"))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(64, kernel_size=3, strides=2, padding="same"))
model.add(ZeroPadding2D(padding=((0,1),(0,1))))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
model.add(Conv2D(128, kernel_size=3, strides=2, padding="same"))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(256, kernel_size=3, strides=1, padding="same"))
model.add(BatchNormalization(momentum=0.8))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
#Building the output layer
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
image = Input(shape=image_shape)
validity = model(image)
return Model(image, validity)
#Step 6: Define a utility function to display th.
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
The Raspberry Pi is a small credit-card sized linux computer. Developers and hobbyists around the world are creating miraculous applications and projects, and now you can join them. Last year we presented Raspberry Pi, What We Have Learned So Far, This year's presentation covers the first steps to using your Pi. From the basics, like burning your SD Card to creating a News Reader, you will learn GPIO Basics and simple Python tools. Communication between other components using SPI or I2C will also be covered. It is recommended, but not required that you have a Raspberry Pi, some knowledge of Python and simple electronics.
Initially created for the Python User Group Freiburg meeting on December 11, 2013. Last updated November 2014.
Source, including codesamples, available at https://github.com/Felix11H/LaTeX-presentations-pygame_intro
An introduction to exploit development.
I gave this talk at Hack the North 2014, and most of this information is pulled out of classics like Smashing the Stack for Fun and Profit, so there shouldn't be anything novel in here.
Getting Started with Raspberry Pi - USC 2013Tom Paulus
The Raspberry Pi is a small credit-card sized linux computer. Developers and hobbyists around the world are creating miraculous applications and projects, and now you can join them. This presentation covers the first steps to using your Pi. From the basics, like burning your SD Card to creating a Weather Reporter. Discussing GPIO Basics and simple Python tools. Communication between other components using SPI or I2C is also covered.
This are my keynote slides from SQL Saturday Oregon 2023 on AI and the Intersection of AI, Machine Learning and Economnic Challenges as a Technical Specialist
This is the second session of the learning pathway at PASS Summit 2019, which is still a stand alone session to teach you how to write proper Linux BASH scripts
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
2. Today’s Goal
Either on a Raspberry Pi or Oracle VirtualBox, (Vbox)
Raspberry Pi image, code two simulated games of chance…
3. Who Will Use Vbox?
Let Kellyn know if you need a copy of the image to import
onto your own PC. She will offer you a USB drive with the
500G OVA file.
The image requires 1G of free memory to use the image.
You will need to “Import” the appliance onto your pc.
The user name=rpi and the password=password
Root password=password
Open up a terminal once you’ve logged in.
4. Connect and Power Up Raspberry
Pi’s
If you are new to Raspberry Pi…
You should also have a micro or SD card for storage
A HDMI monitor
A USB mouse and keyboard
Already performed the setup. If you haven’t, please talk to
Kellyn, she has the OS setup and all appropriate libraries
updated on a secondary card, (both SD or Micro SD format)
Once everything is connected, attach the micro USB power and
plug it in to power up the OS.
Open up a terminal window!
5. Basics of Python
Writing a Python Script, (simple Python Coding) consists of
the following:
1. Import Modules- which are programs already stored in
the system that can be used, saving the programmer time and
allows them to re-use code already available.
2. Define Functions-
3. Build Code into each Function.
4. Execute Functions in order they are to be performed in.
6. Writing a Program/Script is Like
Outlining
What are your Requirements?
List them out, naming them as Functions and DEFINING
each. Entering the command PASS after each one to
“bypass” the function until you are ready to code.
Place them in the order they will execute
Code LAST, filling in each section as you go, testing through
each step.
7. A Python Script Outline
#Our modules will be put in as we go along at the top
def set_board():
pass
def start_motor():
pass
def forward_motor():
pass
def backward_motor():
pass
def motor_cleanup():
pass
#This set of commands executes our functions in the correct order.
set_board()
start_motor()
backward_motor()
motor_cleanup()
8. Fill it in
import time
import gpio
def set_board():
pass
GPIO.setmode(GPIO.BOARD) #Use
Breadboard
Motor1A = 16 #Location of Motor pins
Motor1B = 18
def start_motor():
pass
9. Coding Start and Forward of Motor
import time
import GPIO
def set_board():
GPIO.setmode(GPIO.BOARD)
Motor1A = 16
Motor1B = 18
def start_motor():
pass
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
def forward_motor():
pass
print "Going forwards"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,GPIO.LOW)
time.sleep(2)
11. Time to Code
Log into Your Raspberry Pi and open up a Terminal
Window.
Ensure that the screen background and text is visible and
easy to read, if not, ask Kellyn how to update the preferences
or update it to your liking.
Use an text editor, (vi, nano, etc.) to start a script.
> vi dice_gm.py
12. To Create a Dice Game
Decide what your requirements are.
Create an outline of our simple script
Fill in the code for the function and add any modules that
will need to be imported at the top of the script.
Test and verify that the code works as expected.
13. The Dice Game Requirements
Import the RANDOM module.
Will “roll” the dice 2 times
Will use two dice, with random calls of 1-6.
Will output the first dice ‘+’ the second dice.
15. Code Outline
#Dice Game
import random
def dice_role():
pass
dice_role()
Comments about what we are
coding
Import random module we’ll be
using with this script.
Define your function name
and put in pass as a
“placeholder”
End with Function we
defined to Execute
16. Build out first steps of function
#Dice Game
import random
def dice_role():
for x in range(1, 2):
dice_1 = random.randint(1, 6)
dice_2 = random.randint(1, 6)
dice_role()
We let the program know we are
coding the function by indenting,
using four spaces, then indenting
the subfunction step four more.
17. Finished Script
#Dice Game
import random
def dice_roll():
for x in range(1, 2):
dice_1 = random.randint(1, 6)
dice_2 = random.randint(1, 6)
total = dice_1 + dice_2
if total == 7:
print(‘Seven Thrown!’)
if total == 11:
print(‘Eleven Thrown!’)
if dice_1 == dice_2:
print(‘Doubles!!’)
dice_roll()
Now take the random integers
produced in our “dice roll”, total
them and provide feedback
and the rolls!
18. Execute The Program/Script!
Save the script: <Esc> :wq! or save and exit, etc.
Execute the script to see the results of your work:
> sudo python3 dice_gm.py
19. Pass the Pigs
From Dice to “Pigs”
We will want to show
the roll and display
the points that would
be gained by that roll.
We’ll immediately
break from the turn if
the player hits a Pig
out or an Oinker!
20. Pass the Pigs Script Outline
#Pass the Pigs
import random
def pick_pigs():
pass
pick_pigs()
21. Pass the Pigs, Define our Dice
#Pass the Pigs
import random
def pick_pigs():
for x in range(1, 3): #two dice to roll
dice_roll = random.randint(1, 6) #standard dice
print(dice_rol1) #show us the roll
break
pick_pigs()
22. Pick_Pigs Function, (Deep Breath!)
def pick_pigs():
for x in range(1, 3): #two dice to roll
dice_roll = random.randint(1, 6) #standard dice
print(dice_roll) #show us the roll
if dice_roll == 1:
print(‘Razorback, 5 pts! If you get doubles, 20 pts!’)
elif dice_roll == 2:
print(‘Trotter, 5 pts! If you get doubles, 20 pts!’)
elif dice_roll == 3:
print(‘Snouter, 10 pts! If you get doubles, 40 pts!’)
elif dice_roll == 4:
print(‘Leaning Jowl, 15 pts! If you get doubles, 60 pts!’)
elif dice_roll == 5:
print(‘Pig Out, Back to Zero, Next Players turn unless you get doubles,
then only 1pt!’)
break
elif dice_roll == 6:
print(‘Oinker, Back to ZERO, Next Players Turn!’)
break
23. Finished Program
#Pass the Pigs
import random
def pick_pigs():
for x in range(1, 3): #two dice to roll
dice_roll = random.randint(1, 6) #standard dice
print(dice_roll)
if dice_roll == 1:
print(‘Razorback, 5 pts! If you get doubles, 20 pts!’)
elif dice_roll == 2:
print(‘Trotter, 5 pts! If you get doubles, 20 pts!’)
elif dice_roll == 3:
print(‘Snouter, 10 pts! If you get doubles, 40 pts!’)
elif dice_roll == 4:
print(‘Leaning Jowl, 15 pts! If you get doubles, 60 pts!’)
elif dice_roll == 5:
print(‘Pig Out, Back to Zero, Next Players turn unless you get doubles, then
only 1pt!
break
elif dice_roll == 6:
print(‘Oinker, Back to ZERO, Next Players Turn!’)
break
pick_pigs()
24. Execute our Script
Save our script/code: <Esc> :wq! Or Save and Quit.
Execute our script to see what we’ve coded!
>sudo python3 pass_pigs.py
2
Trotter, 5 pts…
1
Razorback, 5 pts… (for total of 10 pts!)
But if you roll a six in either roll?
6
Oinker, Back to Zero, Next Players
Turn…
25. Next Steps
Consider how this code could be used for other games…
Consider enhancements or using this code in conjunction
with Pygame, (there’s your Google research term… )
Think about how many ways the RANDOM module could
be used for different functional scripts and smarthome
modules, (turn on lights while on vacation at random times
throughout day and evening, etc….)