<commit_before>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield,

"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/Chell1.png")
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)

    def step(self):
        if self.click == 1 and self.alt != 1:
            OrangePortal((self.cox-60,self.coy-70))
            self.click = 0
            self.alt = 0
        if self.click == 1 and self.alt == 1:
            BluePortal((self.cox-60,self.coy-70))
            self.click = 0
            self.alt = 0

        if self.mright == 1:
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cox = event.x
        self.coy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png")
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.visible = True
        self.scale = .25

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png")
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)
        self.image = 0
        self.des = 0

    def step(self):
        self.x = self.x
        self.y = self.y
        if self.des == 1:
            self.destroy
        else:
            self.x = self.x
            self.y = self.y

class PortalGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))

    def step(self):
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,750)
myapp.run()<commit_msg>Updated from Brython Server: 4/21/2016 2:17:56 PM<commit_after>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield,

"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/Chell1.png")
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)

    def step(self):
        if self.click == 1 and self.alt != 1:
            OrangePortal((self.cox-60,self.coy-70))
            self.click = 0
            self.alt = 0
        if self.click == 1 and self.alt == 1:
            BluePortal((self.cox-60,self.coy-70))
            self.click = 0
            self.alt = 0

        if self.mright == 1:
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cox = event.x
        self.coy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png")
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.visible = True
        self.scale = .25

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png")
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)
        self.image = 0
        self.des = 0

    def step(self):
        self.x = self.x
        self.y = self.y
        self.des = 1
        if self.des == 1:
            self.destroy
        else:
            self.x = self.x
            self.y = self.y

class PortalGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))

    def step(self):
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,750)
myapp.run()<|endoftext|>


<commit_before># Django settings for dhlab_backend project.
import os

CURRENT_FILE = os.path.abspath(__file__)
PROJECT_ROOT = os.path.join( os.path.dirname(CURRENT_FILE), '..' )

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'local.db',
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Los_Angeles'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join( PROJECT_ROOT, 'media' )

ADMIN_MEDIA_PREFIX = '/static/admin'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = 'media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join( PROJECT_ROOT, 'static_deploy' )

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, 'static/'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'rt26r6ti28t)=%3q*sqbvr2a^lv+kcx&h&k#uocrh*p_v)+h9f'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'backend.wsgi.application'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'backend',
    'twofactor',                # Needed to harden login/database
    'registration',             # Needed for user signup
    'django.contrib.admin',     # Needed for Django Admin stuff
    'tastypie',                 # Needed for our RESTful API
)

# Set up 2Factor authentication settings
AUTHENTICATION_BACKENDS = (
    'twofactor.auth_backends.TwoFactorAuthBackend',
)

TWOFACTOR_ENCRYPTION_KEY = ''

ACCOUNT_ACTIVATION_DAYS = 1

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
<commit_msg>Missing trailing slash in admin prefix<commit_after># Django settings for dhlab_backend project.
import os

CURRENT_FILE = os.path.abspath(__file__)
PROJECT_ROOT = os.path.join( os.path.dirname(CURRENT_FILE), '..' )

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'local.db',
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Los_Angeles'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join( PROJECT_ROOT, 'media' )

ADMIN_MEDIA_PREFIX = '/static/admin/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = 'media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join( PROJECT_ROOT, 'static_deploy' )

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, 'static/'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'rt26r6ti28t)=%3q*sqbvr2a^lv+kcx&h&k#uocrh*p_v)+h9f'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'backend.wsgi.application'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'backend',
    'twofactor',                # Needed to harden login/database
    'registration',             # Needed for user signup
    'django.contrib.admin',     # Needed for Django Admin stuff
    'tastypie',                 # Needed for our RESTful API
)

# Set up 2Factor authentication settings
AUTHENTICATION_BACKENDS = (
    'twofactor.auth_backends.TwoFactorAuthBackend',
)

TWOFACTOR_ENCRYPTION_KEY = ''

ACCOUNT_ACTIVATION_DAYS = 1

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
<|endoftext|>


<commit_before>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield,
Marcelo Almaguer for the Chell character model used in his own version of Portal called "Remember the Game"
maxiesnax for the Orange Portal Image:0 "http://orig05.deviantart.net/58ec/f/2012/361/2/5/portal___orange_portal_by_maxiesnax-d5pcfmj.png"
Blue Portal Image "http://vignette4.wikia.nocookie.net/kirby-bulborb/images/1/12/Blue_Portal.png/revision/latest?cb=20151004085207"
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/Chell1.png")
    assetflip = ImageAsset("images/Chell2.png")
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        self.op = 0
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)
        self.oportal = None
        self.bportal = None

    def step(self):
        if self.click == 1 and self.alt != 1:
            if self.oportal:
                self.oportal.destroy()
                self.oportal = OrangePortal((self.cox-60,self.coy-70))
                self.click = 0
            else:
                self.oportal = OrangePortal((self.cox-60,self.coy-70))
                self.oportal
                self.click = 0

        if self.click == 1 and self.alt == 1:
            if self.bportal:
                self.bportal.destroy()
                self.bportal = BluePortal((self.cox-60,self.coy-70))
                self.click = 0
            else:
                self.bportal = BluePortal((self.cox-60,self.coy-70))
                self.bportal
                self.click = 0

        if self.mright == 1:
            self.setImage(0)
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.setImage(1)
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cox = event.x
        self.coy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png")
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png")
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class PortalGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))

    def step(self):
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,750)
myapp.run()<commit_msg>Updated from Brython Server: 4/25/2016 2:12:45 PM<commit_after>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield,
Marcelo Almaguer for the Chell character model used in his own version of Portal called "Remember the Game"
maxiesnax for the Orange Portal Image:0 "http://orig05.deviantart.net/58ec/f/2012/361/2/5/portal___orange_portal_by_maxiesnax-d5pcfmj.png"
Blue Portal Image "http://vignette4.wikia.nocookie.net/kirby-bulborb/images/1/12/Blue_Portal.png/revision/latest?cb=20151004085207"
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/Chell1.png", frame(0,0,50,50), 2, 'horizontal')
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        self.op = 0
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)
        self.oportal = None
        self.bportal = None

    def step(self):
        if self.click == 1 and self.alt != 1:
            if self.oportal:
                self.oportal.destroy()
                self.oportal = OrangePortal((self.cox-60,self.coy-70))
                self.click = 0
            else:
                self.oportal = OrangePortal((self.cox-60,self.coy-70))
                self.oportal
                self.click = 0

        if self.click == 1 and self.alt == 1:
            if self.bportal:
                self.bportal.destroy()
                self.bportal = BluePortal((self.cox-60,self.coy-70))
                self.click = 0
            else:
                self.bportal = BluePortal((self.cox-60,self.coy-70))
                self.bportal
                self.click = 0

        if self.mright == 1:
            self.setImage(0)
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.setImage(1)
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cox = event.x
        self.coy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png")
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png")
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class PortalGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))

    def step(self):
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,750)
myapp.run()<|endoftext|>


<commit_before># IdioTest - idiotest/suite.py
# Copyright 2009 Dietrich Epp <depp@zdome.net>
# This source code is licensed under the GNU General Public License,
# Version 3. See gpl-3.0.txt for details.
"""IdioTest test suite.

A test suite scans a directory for test files and organizes them into
a single object.  This also contains code for importing test code and
running it.
"""
import os

def relpath(basepath, path):
    if path == basepath:
        return '.'
    if path.startswith(basepath + os.path.sep):
        return path[len(basepath) + len(os.path.sep):]
    raise Exception("Path %s not a subpath of %s" %
                    (repr(path), repr(basepath)))

class Test(object):
    """A single test.

    Each test is executed with the current working directory set to
    the parent directory of the file containing the test.  Tests are
    assumed to be callable objects which do not take any arguments.
    """
    def __init__(self, cwd, obj):
        if cwd == '.':
            cwd = None
        self.cwd = cwd
        self.obj = obj
    def run(self):
        if self.cwd:
            oldcwd = os.getcwd()
            try:
                os.chdir(self.cwd)
                self.obj()
            finally:
                os.chdir(oldcwd)
        else:
            self.obj()

class TestFile(object):
    """A single file in a test suite.

    Each file can contain multiple tests.  All globals in a file which
    are callable and whose names don't start with an underscore are
    assumed to be individual tests.
    """
    def __init__(self, path, env):
        self.path = path
        self.env = env
    def load(self):
        env = dict(self.env)
        execfile(self.path, env, env)
        tests = {}
        names = []
        cwd = os.path.split(self.path)[0]
        for name, obj in env.items():
            if (name not in self.env
                and not name.startswith('_')
                and hasattr(obj, '__call__')
                and not isinstance(obj, type)):
                tests[name] = Test(cwd, obj)
                names.append(name)
        names.sort()
        self.tests = tests
        self.names = names

class TestSuite(object):
    """An entire suite of tests, spread across multiple files.

    TestSuite(root, env): Create a new test suite, where root is the
    path of the root directory containing all the tests, and env is a
    dictionary for globals that each of the test files will be
    executed in.
    """
    def __init__(self, root, env):
        self.root = root
        self.env = env
    def scan(self):
        """Scan the root directory for test files.

        """
        testfiles = {}
        testnames = []
        for dirpath, dirnames, filenames in os.walk(self.root):
            dirnames[:] = [dirname for dirname in dirnames
                           if not dirname.startswith('.')]
            if dirpath != self.root:
                base = relpath(self.root, dirpath) \
                    .replace(os.path.sep, '.') + '.'
            else:
                base = ''
            for filename in filenames:
                if filename.endswith('.py') and not filename.startswith('.'):
                    path = os.path.join(dirpath, filename)
                    path = os.path.normpath(path)
                    if path == 'test.py':
                        # This is probably the driver script
                        continue
                    name = base + filename[:-3]
                    testnames.append(name)
                    testfiles[name] = TestFile(path, self.env)
        self.files = testfiles
        self.names = testnames
<commit_msg>The driver script should now be skipped again.<commit_after># IdioTest - idiotest/suite.py
# Copyright 2009 Dietrich Epp <depp@zdome.net>
# This source code is licensed under the GNU General Public License,
# Version 3. See gpl-3.0.txt for details.
"""IdioTest test suite.

A test suite scans a directory for test files and organizes them into
a single object.  This also contains code for importing test code and
running it.
"""
import os
import sys

def relpath(basepath, path):
    if path == basepath:
        return '.'
    if path.startswith(basepath + os.path.sep):
        return path[len(basepath) + len(os.path.sep):]
    raise Exception("Path %s not a subpath of %s" %
                    (repr(path), repr(basepath)))

class Test(object):
    """A single test.

    Each test is executed with the current working directory set to
    the parent directory of the file containing the test.  Tests are
    assumed to be callable objects which do not take any arguments.
    """
    def __init__(self, cwd, obj):
        if cwd == '.':
            cwd = None
        self.cwd = cwd
        self.obj = obj
    def run(self):
        if self.cwd:
            oldcwd = os.getcwd()
            try:
                os.chdir(self.cwd)
                self.obj()
            finally:
                os.chdir(oldcwd)
        else:
            self.obj()

class TestFile(object):
    """A single file in a test suite.

    Each file can contain multiple tests.  All globals in a file which
    are callable and whose names don't start with an underscore are
    assumed to be individual tests.
    """
    def __init__(self, path, env):
        self.path = path
        self.env = env
    def load(self):
        env = dict(self.env)
        execfile(self.path, env, env)
        tests = {}
        names = []
        cwd = os.path.split(self.path)[0]
        for name, obj in env.items():
            if (name not in self.env
                and not name.startswith('_')
                and hasattr(obj, '__call__')
                and not isinstance(obj, type)):
                tests[name] = Test(cwd, obj)
                names.append(name)
        names.sort()
        self.tests = tests
        self.names = names

class TestSuite(object):
    """An entire suite of tests, spread across multiple files.

    TestSuite(root, env): Create a new test suite, where root is the
    path of the root directory containing all the tests, and env is a
    dictionary for globals that each of the test files will be
    executed in.
    """
    def __init__(self, root, env):
        self.root = root
        self.env = env
    def scan(self):
        """Scan the root directory for test files.

        """
        testfiles = {}
        testnames = []
        for dirpath, dirnames, filenames in os.walk(self.root):
            is_root = dirpath == self.root == sys.path[0]
            dirnames[:] = [dirname for dirname in dirnames
                           if not dirname.startswith('.')]
            if dirpath != self.root:
                base = relpath(self.root, dirpath) \
                    .replace(os.path.sep, '.') + '.'
            else:
                base = ''
            for filename in filenames:
                if filename.endswith('.py') and not filename.startswith('.'):
                    if is_root and filename == 'test.py':
                        # This is probably the driver script
                        continue
                    path = os.path.join(dirpath, filename)
                    path = os.path.normpath(path)
                    name = base + filename[:-3]
                    testnames.append(name)
                    testfiles[name] = TestFile(path, self.env)
        self.files = testfiles
        self.names = testnames
<|endoftext|>


<commit_before>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield, Mr. Donnelly,
Marcelo Almaguer for the Chell character model used in his own version of Portal called "Remember the Game"
maxiesnax for the Orange Portal Image:0 "http://orig05.deviantart.net/58ec/f/2012/361/2/5/portal___orange_portal_by_maxiesnax-d5pcfmj.png"
Blue Portal Image "http://vignette4.wikia.nocookie.net/kirby-bulborb/images/1/12/Blue_Portal.png/revision/latest?cb=20151004085207"
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/ChellSpriteSheet.png", Frame(0,0,205,361), 2, 'horizontal')
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        self.op = 0
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)
        self.oportal = None
        self.bportal = None
        self.cbx = 0
        self.cby = 0
        self.cox = 0
        self.coy = 0
        self.cpx = 0
        self.cpy = 0

    def step(self):
        if self.click == 1 and self.alt != 1:
            if self.oportal:
                self.oportal.destroy()
                self.oportal = OrangePortal((self.cpx-50,self.cpy-70))
                self.cox = self.cpx
                self.coy = self.cpy
                self.click = 0
            else:
                self.oportal = OrangePortal((self.cpx-50,self.cpy-70))
                self.cox = self.cpx
                self.coy = self.cpy
                self.click = 0

        if self.click == 1 and self.alt == 1:
            if self.bportal:
                self.bportal.destroy()
                self.bportal = BluePortal((self.cpx-50,self.cpy-70))
                self.cbx = self.cpx
                self.cby = self.cpy
                self.click = 0

            else:
                self.bportal = BluePortal((self.cpx-50,self.cpy-70))
                self.cbx = self.cpx
                self.cby = self.cpy
                self.click = 0

        if self.x<=self.cox-20 and self.x>=self.cox-30 and self.bportal and self.y <=self.coy-10 and self.y>=self.coy-40:
            self.x = self.cbx - 10
            self.y = self.cby - 40

        if self.x<=self.cbx-20 and self.x>=self.cbx-30 and self.bportal and self.y <=self.cby-10 and self.y>=self.cby-40:
            self.x = self.cox - 10
            self.y = self.coy - 40

        if self.mright == 1:
            self.setImage(0)
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.setImage(1)
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cpx = event.x
        self.cpy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png", Frame(25,10,350,475), 1, 'vertical')
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png", Frame(25,10,350,475), 1, 'vertical')
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class PortalGame(App):
    bg2 = SoundAsset('portal2_background02.wav')

    def __init__(self, width, height):
        super().__init__(width, height)
        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))
        OrangePortal((0,0))
        BluePortal((0,0))

    def step(self):
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,1000)
myapp.run()<commit_msg>Updated from Brython Server: 4/28/2016 2:23:40 PM<commit_after>"""
FinalProject.py
Author: Avery Wallis
Sources: Hayden Hatfield, Mr. Donnelly,
Marcelo Almaguer for the Chell character model used in his own version of Portal called "Remember the Game"
maxiesnax for the Orange Portal Image:0 "http://orig05.deviantart.net/58ec/f/2012/361/2/5/portal___orange_portal_by_maxiesnax-d5pcfmj.png"
Blue Portal Image "http://vignette4.wikia.nocookie.net/kirby-bulborb/images/1/12/Blue_Portal.png/revision/latest?cb=20151004085207"
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, LineAsset
from ggame import ImageAsset, PolygonAsset, Frame, Sound, SoundAsset

red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
orange = Color(0xffa500, 1.0)
skin =Color(0xFCD15B, 1.0)
wall=Color(0xE8E8E8, 1.0)
orange=Color(0xFFa500,1.0)
plat=Color(0xB9BDBB,1.0)
gooy=Color(0xCDF238,1.0)
white=Color(0xFFFFFF,1.0)
darkblue=Color(0x052099,1.0)

thinline= LineStyle(1, black)
thickline= LineStyle(5, black)
thickishline= LineStyle(2.5, black)
noline=LineStyle(0, black)
portalline=LineStyle(1, blue)
portalline2=LineStyle(1, orange)

wall=RectangleAsset(500,500, noline, wall)
blueportal=EllipseAsset(27, 60, noline, blue)
orangeportal=EllipseAsset(27, 60, noline, orange)
innerportal=EllipseAsset(24, 57, noline, white)
exit=CircleAsset(70, thinline, plat)
exit2=CircleAsset(20, thinline, plat)
plat=RectangleAsset(250, 50, noline, plat)
doorline=LineAsset(0, 120, thinline)
goo=PolygonAsset([(0,500),(800,500),(800,600,),(0,600)],noline,gooy)

class Chell(Sprite):
    asset = ImageAsset("images/ChellSpriteSheet.png", Frame(0,0,205,361), 2, 'horizontal')
    def __init__(self, position):
        super().__init__(Chell.asset, position)
        self.visible = True
        self.x = 250
        self.y = 250
        self.click = 0
        self.mright = 0
        self.mleft = 0
        self.alt = 0
        self.image = 0
        self.scale = .25
        self.op = 0
        PortalGame.listenKeyEvent("keydown", "d", self.rightOn)
        PortalGame.listenKeyEvent("keyup", "d", self.rightOff)
        PortalGame.listenKeyEvent("keydown", "a", self.leftOn)
        PortalGame.listenKeyEvent("keyup", "a", self.leftOff)
        PortalGame.listenMouseEvent("click", self.ClickOn)
        PortalGame.listenKeyEvent("keydown", "alt", self.altOn)
        PortalGame.listenKeyEvent("keyup", "alt", self.altOff)
        self.oportal = None
        self.bportal = None
        self.cbx = 0
        self.cby = 0
        self.cox = 0
        self.coy = 0
        self.cpx = 0
        self.cpy = 0

    def step(self):
        if self.click == 1 and self.alt != 1:
            if self.oportal:
                self.oportal.destroy()
                self.oportal = OrangePortal((self.cpx-50,self.cpy-70))
                self.cox = self.cpx
                self.coy = self.cpy
                self.click = 0
            else:
                self.oportal = OrangePortal((self.cpx-50,self.cpy-70))
                self.cox = self.cpx
                self.coy = self.cpy
                self.click = 0

        if self.click == 1 and self.alt == 1:
            if self.bportal:
                self.bportal.destroy()
                self.bportal = BluePortal((self.cpx-50,self.cpy-70))
                self.cbx = self.cpx
                self.cby = self.cpy
                self.click = 0

            else:
                self.bportal = BluePortal((self.cpx-50,self.cpy-70))
                self.cbx = self.cpx
                self.cby = self.cpy
                self.click = 0

        if self.x<=self.cox-20 and self.x>=self.cox-30 and self.bportal and self.y <=self.coy-10 and self.y>=self.coy-40:
            self.x = self.cbx - 10
            self.y = self.cby - 40

        if self.x<=self.cbx-20 and self.x>=self.cbx-30 and self.bportal and self.y <=self.cby-10 and self.y>=self.cby-40:
            self.x = self.cox - 10
            self.y = self.coy - 40

        if self.mright == 1:
            self.setImage(0)
            self.x += .75
            self.y = self.y
        if self.mright == 0:
            self.x =self.x
            self.y=self.y
        if self.mleft == 1:
            self.setImage(1)
            self.x += -.75
            self.y = self.y
        if self.mleft == 0:
            self.x = self.x
            self.y = self.y

    def ClickOn(self,event):
        self.click = 1
        self.cpx = event.x
        self.cpy = event.y
    def rightOn(self,event):
        self.mright = 1
    def rightOff(self,event):
        self.mright = 0
    def leftOn(self,event):
        self.mleft = 1
    def leftOff(self,event):
        self.mleft = 0
    def altOn(self,event):
        self.alt = 1
    def altOff(self,event):
        self.alt = 0

class BluePortal(Sprite):
    asset = ImageAsset("images/Blue_Portal.png", Frame(25,10,350,475), 1, 'vertical')
    def __init__(self, position):
        super().__init__(BluePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class OrangePortal(Sprite):
    asset = ImageAsset("images/portal___orange_portal_by_maxiesnax-d5pcfmj.png", Frame(25,10,350,475), 1, 'vertical')
    def __init__(self, position):
        super().__init__(OrangePortal.asset, position)
        self.scale = .25
        self.center = (0,0)

    def step(self):
        self.x = self.x
        self.y = self.y

class PortalGame(App):
    bg2 = SoundAsset('portal2_background02.wav')

    def __init__(self, width, height):
        super().__init__(width, height)
        self.bg2 = Sound(PortalGame.bg2)
        self.bg2.volume= 10

        Sprite(wall, (400,20))
        Sprite(wall, (100,20))
        Sprite(exit, (800,100))
        Sprite(exit2, (800, 100))
        Sprite(doorline, (800, 30))
        Sprite(plat, (100,400))
        Sprite(plat, (650, 150))
        Sprite(goo, (100,0))
        Chell((0,0))
        OrangePortal((0,0))
        BluePortal((0,0))

    def step(self):
        self.bg2.play()
        for chell in self.getSpritesbyClass(Chell):
            chell.step()

myapp = PortalGame(1000,1000)
myapp.run()<|endoftext|>


<commit_before>
one = input("Welcome to the Text-based The Long Night Recreation.\n(Press Enter)")
two = input("A strange electromagnetic storm has crashed your plane in Northern Canada. How long can you survive? \n(Press Enter)")

Freeze = 8
def FirstChoice():
    first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")
    if first_choice.lower() == "a":
        Freezing()
        North()
    elif first_choice.lower() == "b":
        Freezing()
        East()

    elif first_choice.lower() == "c":
        Freezing()
        South()

    elif first_choice.lower() == "d":
        Freezing()
        West()

    elif first_choice.lower() == "e":
        SearchPlane()

    elif first_choice.lower() == "f":
        Freezing()
        Wait()

def Freezing():
    Freeze -= 1
    if Freeze == 0:
        printz = input("The cold overcomes you, and you fall. Your vision darkens as the snow rushes up to meet you. You have died by frostbite.")

    else:
        print("The cold is starting to get to you. Find some shelter fast.")
def Wait():
    print("The snow whistles, and the wind whips up your hair as you sit and wait. Sound of the forest can be heard. Howls echo through the trees, and chirps of birds are a rare occurance.")
    Freezing()
    first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")

    if first_choice.lower() == "a":
        North()
    elif first_choice.lower() == "b":
        East()
        Freezing()
    elif first_choice.lower() == "c":
        South()
        Freezing()
    elif first_choice.lower() == "d":
        West()
        Freezing()
    elif first_choice.lower() == "e":
        SearchPlane()
    elif first_choice.lower() == "f":
        Wait()
        Freezing()

    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")

def Nothing():
    print("As you trudge through the woods, nothing seems out of the ordinary.")
    Freezing()
    CardinalChoice2()
def CardinalChoice2():
    printt = input("You sense of direction has been lost from walking through the woods. Which direction would you like to try to go?\n(a) North\n(b) East\n(c) South\n(d) West \nChoice:")
    if printt == "a":
        Freezing()
        SeeWolf()
    elif printt.lower() == "b" :
        Freezing()
        CardinalChoice2()
    elif printt.lower() == "c":
        Freezing()
        CardinalChoice2()
    elif printt.lower() == "d":
        Freezing()
        CardnialChoice2()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def PossibleWolf2():
    choiceW = input("After seeing the wolf you come to a clearing. Which direction would you like to go?\n(a) North\n(b) East\n(c) South\n(d) West")
    if choiceW.lower == "a":
        print("You trudge through the snow past trees and small snow-mounds towards North.")
        Freezing()
        WolfAttack()
    elif choiceW == "b":
        print("You trudge through the snow past trees and small snow-mounds towards East.")
        House()
    elif choiceW == "c":
        print("You trudge through the snow past trees and small snow-mounds towards South.")
        Freezing()
        WolfAttack()
    elif choiceW == "d":
        print("You trudge through the snow past trees and small snow-mounds towards West.")
        Freezing()
        WolfAttack()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def PossibleWolf():
    choiceZ = input("After seeing the wolf you come to a clearing. Which direction would you like to go?\n(a) North\n(b) East\n(c) South\n(d) West")
    if choicez.lower == "a":
        print("You trudge through the snow past trees and small snow-mounds towards North.")
        Freezing()
        WolfAttack()
    elif choicez == "b":
        print("You trudge through the snow past trees and small snow-mounds towards East.")
        Freezing()
        WolfAttack()
    elif choicez == "c":
        print("You trudge through the snow past trees and small snow-mounds towards South.")
        Freezing()
        WolfAttack()
    elif choicez == "d":
        print("You trudge through the snow past trees and small snow-mounds towards West.")
        Freezing()
        PossibleWolf2()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def SeeWolf():
    Freezing
    print("You notice a lupine shape run past a few meters from you. It does not give you a second thought, and quickly leaves your sight.")
    CardinalChoice2()
def WolfAttack():
    print("You trudge through the snow, and all of a sudden a noise break the silence. You hear howling, as the crunches of multiple paws racing through the snow surround you completely. The eyes of the wolves all around you spell certain death.")

def House():
    print("As you crest the hill, a small lodge comes into your vision. You race towards the warmth and your only way of survival.")
    WIN = input("You have completed the Text-Based The Long Night Recreation Game. Congratulations! Don't tell your friends how to win though   ;D")
def North():
    print("You trudge through the snow past trees and small snow-mounds towards North.")
    Freezing()
    CardnialCHoice2
def South():
    print("You trudge through the snow past trees and small snow-mounds towards South.")
    Freezing()
    SeeWolf()
def East():
    print("You trudge through the snow past trees and small snow-mounds towards East.")
    Freezing()
    CardinalChoice2()
def West():
    print("You trudge through the snow past trees and small snow-mounds towards West.")
    Freezing()
   CardinalChoice2()
def SearchPlane():
    print("You trudge through the snow to the plane, only to find that the fire does not allow you to access the plane. However, it does seem warmer here.")
    FirstChoice()
def CardinalChoice():
    Cardinal_Direction = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West")
    if Cardinal_Direction.lower() == "a":
        Freezing()
        North()

    elif Cardinal_Direction.lower() == "b":
        Freezing()
        East()

    elif Cardinal_Direction.lower() == "c":
        Freezing()
        South()

    elif Cardinal_Direction.lower() == "d":
        Freezing()
        West()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
three = input("You find yourself in a clearing 200 meters in diameter. It is surrounded by snow-laden conifers, with no buildings in sight.\n(Press Enter)")
four = input("You are standing in the middle next to your downed plane, flames still licking across the chasis, and a rut in the snow leads from the plane to about 40 meters to the right.\n(Press Enter)")
first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")
if first_choice.lower() == "a":
    Freezing()
    North()
elif first_choice.lower() == "b":
    Freezing()
    East()

elif first_choice.lower() == "c":
    Freezing()
    South()

elif first_choice.lower() == "d":
    Freezing()
    West()

elif first_choice.lower() == "e":
    SearchPlane()

elif first_choice.lower() == "f":
    Freezing()
    Wait()

else:
    print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
<commit_msg>Updated from Brython Server: 1/8/2016 2:57:50 PM<commit_after>
one = input("Welcome to the Text-based The Long Night Recreation.\n(Press Enter)")
two = input("A strange electromagnetic storm has crashed your plane in Northern Canada. How long can you survive? \n(Press Enter)")

Freeze = 8
def FirstChoice():
    first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")
    if first_choice.lower() == "a":
        Freezing()
        North()
    elif first_choice.lower() == "b":
        Freezing()
        East()

    elif first_choice.lower() == "c":
        Freezing()
        South()

    elif first_choice.lower() == "d":
        Freezing()
        West()

    elif first_choice.lower() == "e":
        SearchPlane()

    elif first_choice.lower() == "f":
        Freezing()
        Wait()

def Freezing():
    Freeze -= 1
    if Freeze == 0:
        printz = input("The cold overcomes you, and you fall. Your vision darkens as the snow rushes up to meet you. You have died by frostbite.")

    else:
        print("The cold is starting to get to you. Find some shelter fast.")
def Wait():
    print("The snow whistles, and the wind whips up your hair as you sit and wait. Sound of the forest can be heard. Howls echo through the trees, and chirps of birds are a rare occurance.")
    Freezing()
    first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")

    if first_choice.lower() == "a":
        North()
    elif first_choice.lower() == "b":
        East()
        Freezing()
    elif first_choice.lower() == "c":
        South()
        Freezing()
    elif first_choice.lower() == "d":
        West()
        Freezing()
    elif first_choice.lower() == "e":
        SearchPlane()
    elif first_choice.lower() == "f":
        Wait()
        Freezing()

    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")

def Nothing():
    print("As you trudge through the woods, nothing seems out of the ordinary.")
    Freezing()
    CardinalChoice2()
def CardinalChoice2():
    printt = input("You sense of direction has been lost from walking through the woods. Which direction would you like to try to go?\n(a) North\n(b) East\n(c) South\n(d) West \nChoice:")
    if printt == "a":
        Freezing()
        SeeWolf()
    elif printt.lower() == "b" :
        Freezing()
        CardinalChoice2()
    elif printt.lower() == "c":
        Freezing()
        CardinalChoice2()
    elif printt.lower() == "d":
        Freezing()
        CardnialChoice2()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def PossibleWolf2():
    choiceW = input("After seeing the wolf you come to a clearing. Which direction would you like to go?\n(a) North\n(b) East\n(c) South\n(d) West")
    if choiceW.lower == "a":
        print("You trudge through the snow past trees and small snow-mounds towards North.")
        Freezing()
        WolfAttack()
    elif choiceW == "b":
        print("You trudge through the snow past trees and small snow-mounds towards East.")
        House()
    elif choiceW == "c":
        print("You trudge through the snow past trees and small snow-mounds towards South.")
        Freezing()
        WolfAttack()
    elif choiceW == "d":
        print("You trudge through the snow past trees and small snow-mounds towards West.")
        Freezing()
        WolfAttack()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def PossibleWolf():
    choiceZ = input("After seeing the wolf you come to a clearing. Which direction would you like to go?\n(a) North\n(b) East\n(c) South\n(d) West")
    if choicez.lower == "a":
        print("You trudge through the snow past trees and small snow-mounds towards North.")
        Freezing()
        WolfAttack()
    elif choicez == "b":
        print("You trudge through the snow past trees and small snow-mounds towards East.")
        Freezing()
        WolfAttack()
    elif choicez == "c":
        print("You trudge through the snow past trees and small snow-mounds towards South.")
        Freezing()
        WolfAttack()
    elif choicez == "d":
        print("You trudge through the snow past trees and small snow-mounds towards West.")
        Freezing()
        PossibleWolf2()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
def SeeWolf():
    Freezing
    print("You notice a lupine shape run past a few meters from you. It does not give you a second thought, and quickly leaves your sight.")
    CardinalChoice2()
def WolfAttack():
    print("You trudge through the snow, and all of a sudden a noise break the silence. You hear howling, as the crunches of multiple paws racing through the snow surround you completely. The eyes of the wolves all around you spell certain death.")

def House():
    print("As you crest the hill, a small lodge comes into your vision. You race towards the warmth and your only way of survival.")
    WIN = input("You have completed the Text-Based The Long Night Recreation Game. Congratulations! Don't tell your friends how to win though   ;D")
def North():
    print("You trudge through the snow past trees and small snow-mounds towards North.")
    Freezing()
    CardnialCHoice2
def South():
    print("You trudge through the snow past trees and small snow-mounds towards South.")
    Freezing()
    SeeWolf()
def East():
    print("You trudge through the snow past trees and small snow-mounds towards East.")
    Freezing()
    CardinalChoice2()
def West():
    print("You trudge through the snow past trees and small snow-mounds towards West.")
    Freezing()
    CardinalChoice2()
def SearchPlane():
    print("You trudge through the snow to the plane, only to find that the fire does not allow you to access the plane. However, it does seem warmer here.")
    FirstChoice()
def CardinalChoice():
    Cardinal_Direction = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West")
    if Cardinal_Direction.lower() == "a":
        Freezing()
        North()

    elif Cardinal_Direction.lower() == "b":
        Freezing()
        East()

    elif Cardinal_Direction.lower() == "c":
        Freezing()
        South()

    elif Cardinal_Direction.lower() == "d":
        Freezing()
        West()
    else:
        print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
three = input("You find yourself in a clearing 200 meters in diameter. It is surrounded by snow-laden conifers, with no buildings in sight.\n(Press Enter)")
four = input("You are standing in the middle next to your downed plane, flames still licking across the chasis, and a rut in the snow leads from the plane to about 40 meters to the right.\n(Press Enter)")
first_choice = input("You check your compass, and you are facing North. What will you do? \n(a) Go North \n(b) Go East \n(c) Go South \n(d) Go West \n(e) Search the Plane \n(f) Wait an hour \nChoice: ")
if first_choice.lower() == "a":
    Freezing()
    North()
elif first_choice.lower() == "b":
    Freezing()
    East()

elif first_choice.lower() == "c":
    Freezing()
    South()

elif first_choice.lower() == "d":
    Freezing()
    West()

elif first_choice.lower() == "e":
    SearchPlane()

elif first_choice.lower() == "f":
    Freezing()
    Wait()

else:
    print("That is not a valid choice. Please resart the program, and make sure not to include anything other than the letter of the choice in the input box.")
<|endoftext|>


<commit_before>#!/usr/bin/env python
# Twisted IEMBot! :)

from twisted.words.protocols.jabber import client, jid, xmlstream
from twisted.words.xish import domish, xpath
from twisted.internet import reactor
from twisted.web import server, xmlrpc
from twisted.internet import reactor
from twisted.python import log

import pdb, mx.DateTime, socket, traceback

from secret import *
#log.startLogging( open('twisted.log', 'w') )

CHATLOG = {}

class IEMChatXMLRPC(xmlrpc.XMLRPC):

    def xmlrpc_getUpdate(self, room, seqnum):
        """ Return most recent messages since timestamp (ticks...) """
        #fts = float(timestamp) / 10

        #print "XMLRPC-request", room, seqnum, CHATLOG[room]['seqnum']
        r = []
        if (not CHATLOG.has_key(room)):
            return r
        for k in range(len(CHATLOG[room]['seqnum'])):
            if (CHATLOG[room]['seqnum'][k] > seqnum):
                ts = mx.DateTime.DateTimeFromTicks( CHATLOG[room]['timestamps'][k] / 100.0)
                r.append( [ CHATLOG[room]['seqnum'][k] , ts.strftime("%Y%m%d%H%M%S"), CHATLOG[room]['author'][k], CHATLOG[room]['log'][k] ] )
        #print r
        return r

class JabberClient:
    xmlstream = None

    def __init__(self, myJid):
        self.myJid = myJid
        self.seqnum = 0

    def keepalive(self):
        presence = domish.Element(('', 'presence'))
        presence.addElement('show').addContent('away')
        presence.addElement('status').addContent('Happy am I, iembot!')
        self.xmlstream.send(presence)

        iq = client.IQ(self.xmlstream, "get")
        iq.addElement(("http://jabber.org/protocol/disco#items", "query"))
        iq.query['node'] = "sessions"
        iq.send()

        socket.setdefaulttimeout(60)
        reactor.callLater(6*60, self.keepalive)

    def rawDataInFn(self, data):
        print 'RECV', unicode(data,'utf-8','ignore').encode('ascii', 'replace')
    def rawDataOutFn(self, data):
        print 'SEND', unicode(data,'utf-8','ignore').encode('ascii', 'replace')

    def authd(self,xmlstream):
        print "Logged into Jabber Chat Server!"
        self.xmlstream = xmlstream
        self.xmlstream.rawDataInFn = self.rawDataInFn
        self.xmlstream.rawDataOutFn = self.rawDataOutFn

        presence = domish.Element(('jabber:client','presence'))
        presence.addElement('status').addContent('Online')
        xmlstream.send(presence)

        self.keepalive()

        rooms = ['wxiaweather', 'kccichat', 'vipir6and7', 'abc3340', 'dmxschoolchat', 'bmxemachat', 'fwdemachat', 'botstalk', 'peopletalk', 'ABQ', 'AFC', 'AFG', 'AJK', 'AKQ', 'ALY', 'AMA', 'BGM', 'BMX', 'BOI', 'BOU', 'BOX', 'BRO', 'BTV', 'BUF', 'BYZ', 'CAE', 'CAR', 'CHS', 'CRP', 'CTP', 'CYS', 'EKA', 'EPZ', 'EWX', 'KEY', 'FFC', 'FGZ', 'FWD', 'GGW', 'GJT', 'GSP', 'GYX', 'HFO', 'HGX', 'HNX', 'HUN','ILM', 'JAN', 'JAX', 'JKL', 'LCH', 'LIX', 'LKN', 'LMK', 'LOX', 'LUB', 'LWX', 'LZK', 'MAF', 'MEG', 'MFL', 'MFR', 'MHX', 'MLB', 'MOB', 'MRX', 'MSO', 'MTR', 'OHX', 'OKX', 'OTX', 'OUN', 'PAH', 'PBZ', 'PDT', 'PHI', 'PIH', 'PQR', 'PSR', 'PUB', 'RAH', 'REV', 'RIW', 'RLX', 'RNK', 'SEW', 'SGX', 'SHV', 'SJT', 'SJU', 'SLC', 'STO', 'TAE', 'TBW', 'TFX', 'TSA', 'TWC', 'VEF', 'ABR', 'APX', 'ARX', 'BIS', 'CLE', 'DDC', 'DLH', 'DTX', 'DVN', 'EAX', 'FGF', 'FSD', 'GID', 'GLD', 'GRB', 'GRR', 'ICT', 'ILN', 'ILX', 'IND', 'IWX', 'LBF', 'LOT', 'LSX', 'MKX', 'MPX', 'MQT', 'OAX', 'SGF', 'TOP', 'UNR', 'DMX', 'XXX']
        for rm in rooms:
            presence = domish.Element(('jabber:client','presence'))
            presence['to'] = "%s@conference.%s/iembot" % (rm.lower(), CHATSERVER)
            if (len(rm) == 3):
                presence['to'] = "%schat@conference.%s/iembot" % (rm.lower(), CHATSERVER)
            xmlstream.send(presence)

        #xmlstream.addObserver('/message',  self.debug)
        xmlstream.addObserver('/message',  self.processMessage)
        #xmlstream.addObserver('/iq',  self.debug)
        #xmlstream.addObserver('/presence',  self.debug)

    def failure(self, f):
        print f

    def debug(self, elem):
        print elem.toXml().encode('utf-8')
        print "="*20

    def nextSeqnum(self,):
        self.seqnum += 1
        return self.seqnum

    def processMessage(self, elem):
        _from = jid.JID( elem["from"] )
        t = ""
        try:
            t = elem["type"]
        except:
            print elem.toXml(), 'BOOOOOOO'

        if (t == "groupchat"):
            #print elem.toXml(), '----', str(elem.children), '---'
            room = _from.user
            res = _from.resource
            if (res is None): res = "---"
            if (not CHATLOG.has_key(room)):
                CHATLOG[room] = {'seqnum': [-1]*40, 'timestamps': [0]*40,
                                 'log': ['']*40, 'author': ['']*40}
            ticks = int(mx.DateTime.gmt().ticks() * 100)
            x = xpath.queryForNodes('/message/x', elem)
            if (x is not None and x[0].hasAttribute("stamp") ):
                xdelay = x[0]['stamp']
                print "FOUND Xdelay", xdelay, ":"
                delayts = mx.DateTime.strptime(xdelay, "%Y%m%dT%H:%M:%S")
                ticks = int(delayts.ticks() * 100)
            elif (x is not None):
                print "What is this?", x[0].toXml()

            CHATLOG[room]['seqnum'] = CHATLOG[room]['seqnum'][1:] + [self.nextSeqnum(),]
            CHATLOG[room]['timestamps'] = CHATLOG[room]['timestamps'][1:] + [ticks,]
            CHATLOG[room]['author'] = CHATLOG[room]['author'][1:] + [res,]

            # Go digging for body
            #print "xpath Q:", xpath.queryForString('/message/body', elem)
            html = xpath.queryForNodes('/message/html/body', elem)
            if (html != None):
                CHATLOG[room]['log'] = CHATLOG[room]['log'][1:] + [html[0].toXml(),]
            else:
                try:
                    body = xpath.queryForString('/message/body', elem)
                    CHATLOG[room]['log'] = CHATLOG[room]['log'][1:] + [body,]
                except:
                    print room, 'VERY VERY BAD'

            #ping pong, sigh!
            # If the message is x-delay, old message, no relay
            try:
                bstring = xpath.queryForString('/message/body', elem)
                if (x is None and len(bstring) >= 4 and bstring[:4] == "ping"):
                    message = domish.Element(('jabber:client','message'))
                    message['to'] = "%s@conference.%s" %(room,CHATSERVER)
                    message['type'] = "groupchat"
                    message.addElement('body',None,"%s: pong"%(res,))
                    self.xmlstream.send(message)
                if (x is None and res != "iembot"):
                    message = domish.Element(('jabber:client','message'))
                    message['to'] = "peopletalk@conference.%s" %(CHATSERVER,)
                    message['type'] = "groupchat"
                    message.addElement('body',None,"%s [%s] %s"%(res,room,bstring))
                    self.xmlstream.send(message)
            except:
                print traceback.print_exc()
                pass

        elif (t == "chat" or t == ""):
            if (_from.userhost() == "iembot_ingest@%s" % (CHATSERVER,) ):
                """ Go look for body to see routing info! """
                wfo = None
                # Get the body string
                bstring = xpath.queryForString('/message/body', elem)
                htmlstr = xpath.queryForString('/message/html/body', elem)
                if (len(bstring) < 3):
                    print "BAD!!!"
                    return
                wfo = bstring[:3]
                # Look for HTML
                html = xpath.queryForNodes('/message/html', elem)

                # Route message to botstalk room in tact
                message = domish.Element(('jabber:client','message'))
                message['to'] = "botstalk@conference.%s" % (CHATSERVER,)
                message['type'] = "groupchat"
                message.addChild( elem.body )
                if (elem.html):
                    message.addChild(elem.html)
                self.xmlstream.send(message)

                # Send to chatroom, clip body
                message = domish.Element(('jabber:client','message'))
                message['to'] = "%schat@conference.%s" % (wfo.lower(), CHATSERVER,)
                message['type'] = "groupchat"
                message.addElement('body',None,bstring[4:])
                if (elem.html):
                    message.addChild(elem.html)

                self.xmlstream.send(message)
                if (wfo.upper() == "BMX" or wfo.upper() == "FWD"):
                    message['to'] = "%semachat@conference.%s" % (wfo.lower(), CHATSERVER)
                    self.xmlstream.send(message)
                if (wfo.upper() == "BMX" or wfo.upper() == "HUN"):
                    message['to'] = "abc3340@conference.%s" % ( CHATSERVER,)
                    self.xmlstream.send(message)
                if (wfo.upper() == "MOB" or wfo.upper() == "TAE" or wfo.upper() == "BMX"):
                    message['to'] = "vipir6and7@conference.%s" % ( CHATSERVER,)
                    self.xmlstream.send(message)
                if (wfo.upper() == "FFC"):
                    message['to'] = "wxiaweather@conference.%s" % ( CHATSERVER,)
                    self.xmlstream.send(message)
                if (wfo.upper() == "DMX"):
                    message['to'] = "%sschoolchat@conference.%s" % (wfo.lower(), CHATSERVER)
                    self.xmlstream.send(message)
                    message['to'] = "kccichat@conference.%s" % (CHATSERVER,)
                    self.xmlstream.send(message)

myJid = jid.JID('iembot@%s/twisted_words' % (CHATSERVER,) )
factory = client.basicClientFactory(myJid, IEMCHAT_PASS)

jabber = JabberClient(myJid)

factory.addBootstrap('//event/stream/authd',jabber.authd)
#factory.addBootstrap("//event/client/basicauth/invaliduser", jabber.failure)
#factory.addBootstrap("//event/client/basicauth/authfailed", jabber.failure)
#factory.addBootstrap("//event/stream/error", jabber.failure)

#reactor.connectTCP(CHATSERVER,5222,factory)
reactor.connectTCP('localhost',5222,factory)

xmlrpc = IEMChatXMLRPC()
reactor.listenTCP(8002, server.Site(xmlrpc))

reactor.run()

<commit_msg>More undocumented changes<commit_after>#!/usr/bin/env python
# Twisted IEMBot! :)

from twisted.words.protocols.jabber import client, jid, xmlstream
from twisted.words.xish import domish, xpath
from twisted.internet import reactor
from twisted.web import server, xmlrpc
from twisted.internet import reactor
from twisted.python import log

import pdb, mx.DateTime, socket, traceback
import StringIO, traceback, smtplib
from email.MIMEText import MIMEText

from secret import *
#log.startLogging( open('twisted.log', 'w') )

CHATLOG = {}

class IEMChatXMLRPC(xmlrpc.XMLRPC):

    def xmlrpc_getUpdate(self, room, seqnum):
        """ Return most recent messages since timestamp (ticks...) """
        #fts = float(timestamp) / 10

        #print "XMLRPC-request", room, seqnum, CHATLOG[room]['seqnum']
        r = []
        if (not CHATLOG.has_key(room)):
            return r
        for k in range(len(CHATLOG[room]['seqnum'])):
            if (CHATLOG[room]['seqnum'][k] > seqnum):
                ts = mx.DateTime.DateTimeFromTicks( CHATLOG[room]['timestamps'][k] / 100.0)
                r.append( [ CHATLOG[room]['seqnum'][k] , ts.strftime("%Y%m%d%H%M%S"), CHATLOG[room]['author'][k], CHATLOG[room]['log'][k] ] )
        #print r
        return r

class JabberClient:
    xmlstream = None

    def __init__(self, myJid):
        self.myJid = myJid
        self.seqnum = 0

    def keepalive(self):
        presence = domish.Element(('', 'presence'))
        presence.addElement('show').addContent('away')
        presence.addElement('status').addContent('Happy am I, iembot!')
        self.xmlstream.send(presence)

        iq = client.IQ(self.xmlstream, "get")
        iq.addElement(("http://jabber.org/protocol/disco#items", "query"))
        iq.query['node'] = "sessions"
        iq.send()

        socket.setdefaulttimeout(60)
        reactor.callLater(6*60, self.keepalive)

    def rawDataInFn(self, data):
        print 'RECV', unicode(data,'utf-8','ignore').encode('ascii', 'replace')
    def rawDataOutFn(self, data):
        print 'SEND', unicode(data,'utf-8','ignore').encode('ascii', 'replace')

    def authd(self,xmlstream):
        print "Logged into Jabber Chat Server!"
        self.xmlstream = xmlstream
        self.xmlstream.rawDataInFn = self.rawDataInFn
        self.xmlstream.rawDataOutFn = self.rawDataOutFn

        presence = domish.Element(('jabber:client','presence'))
        presence.addElement('status').addContent('Online')
        xmlstream.send(presence)

        self.keepalive()

        rooms = ['mlbemchat', 'wxiaweather', 'kccichat', 'vipir6and7', 'abc3340', 'dmxemchat','janhydrochat', 'bmxemachat', 'fwdemachat', 'tbwemchat', 'botstalk', 'peopletalk', 'ABQ', 'AFC', 'AFG', 'AJK', 'AKQ', 'ALY', 'AMA', 'BGM', 'BMX', 'BOI', 'BOU', 'BOX', 'BRO', 'BTV', 'BUF', 'BYZ', 'CAE', 'CAR', 'CHS', 'CRP', 'CTP', 'CYS', 'EKA', 'EPZ', 'EWX', 'KEY', 'FFC', 'FGZ', 'FWD', 'GGW', 'GJT', 'GSP', 'GYX', 'HFO', 'HGX', 'HNX', 'HUN','ILM', 'JAN', 'JAX', 'JKL', 'LCH', 'LIX', 'LKN', 'LMK', 'LOX', 'LUB', 'LWX', 'LZK', 'MAF', 'MEG', 'MFL', 'MFR', 'MHX', 'MLB', 'MOB', 'MRX', 'MSO', 'MTR', 'OHX', 'OKX', 'OTX', 'OUN', 'PAH', 'PBZ', 'PDT', 'PHI', 'PIH', 'PQR', 'PSR', 'PUB', 'RAH', 'REV', 'RIW', 'RLX', 'RNK', 'SEW', 'SGX', 'SHV', 'SJT', 'SJU', 'SLC', 'STO', 'TAE', 'TBW', 'TFX', 'TSA', 'TWC', 'VEF', 'ABR', 'APX', 'ARX', 'BIS', 'CLE', 'DDC', 'DLH', 'DTX', 'DVN', 'EAX', 'FGF', 'FSD', 'GID', 'GLD', 'GRB', 'GRR', 'ICT', 'ILN', 'ILX', 'IND', 'IWX', 'LBF', 'LOT', 'LSX', 'MKX', 'MPX', 'MQT', 'OAX', 'SGF', 'TOP', 'UNR', 'DMX', 'XXX']
        for rm in rooms:
            presence = domish.Element(('jabber:client','presence'))
            presence['to'] = "%s@conference.%s/iembot" % (rm.lower(), CHATSERVER)
            if (len(rm) == 3):
                presence['to'] = "%schat@conference.%s/iembot" % (rm.lower(), CHATSERVER)
            xmlstream.send(presence)

        #xmlstream.addObserver('/message',  self.debug)
        xmlstream.addObserver('/message',  self.processor)
        #xmlstream.addObserver('/iq',  self.debug)
        #xmlstream.addObserver('/presence',  self.debug)

    def failure(self, f):
        print f

    def debug(self, elem):
        print elem.toXml().encode('utf-8')
        print "="*20

    def nextSeqnum(self,):
        self.seqnum += 1
        return self.seqnum

    def processMessageGC(self, elem):
        _from = jid.JID( elem["from"] )
        room = _from.user
        res = _from.resource
        if (res is None): res = "---"
        if (not CHATLOG.has_key(room)):
            CHATLOG[room] = {'seqnum': [-1]*40, 'timestamps': [0]*40,
                             'log': ['']*40, 'author': ['']*40}
        ticks = int(mx.DateTime.gmt().ticks() * 100)
        x = xpath.queryForNodes('/message/x', elem)
        if (x is not None and x[0].hasAttribute("stamp") ):
            xdelay = x[0]['stamp']
            print "FOUND Xdelay", xdelay, ":"
            delayts = mx.DateTime.strptime(xdelay, "%Y%m%dT%H:%M:%S")
            ticks = int(delayts.ticks() * 100)
        elif (x is not None):
            print "What is this?", x[0].toXml()

        CHATLOG[room]['seqnum'] = CHATLOG[room]['seqnum'][1:] + [self.nextSeqnum(),]
        CHATLOG[room]['timestamps'] = CHATLOG[room]['timestamps'][1:] + [ticks,]
        CHATLOG[room]['author'] = CHATLOG[room]['author'][1:] + [res,]

        html = xpath.queryForNodes('/message/html/body', elem)
        if (html != None):
            CHATLOG[room]['log'] = CHATLOG[room]['log'][1:] + [html[0].toXml(),]
        else:
            try:
                body = xpath.queryForString('/message/body', elem)
                CHATLOG[room]['log'] = CHATLOG[room]['log'][1:] + [body,]
            except:
                print room, 'VERY VERY BAD'

            #ping pong, sigh!
            # If the message is x-delay, old message, no relay
        try:
            bstring = xpath.queryForString('/message/body', elem)
            if (x is None and len(bstring) >= 4 and bstring[:4] == "ping"):
                message = domish.Element(('jabber:client','message'))
                message['to'] = "%s@conference.%s" %(room,CHATSERVER)
                message['type'] = "groupchat"
                message.addElement('body',None,"%s: pong"%(res,))
                self.xmlstream.send(message)
            if (x is None and res != "iembot" and room not in ['wxiaweather', 'kccichat', 'vipir6and7', 'abc3340', 'dmxemchat', 'janhydrochat', 'bmxemachat', 'fwdemachat', 'botstalk', 'peopletalk','tbwemchat','mlbemchat']):
                message = domish.Element(('jabber:client','message'))
                message['to'] = "peopletalk@conference.%s" %(CHATSERVER,)
                message['type'] = "groupchat"
                message.addElement('body',None,"[%s] %s: %s"%(room,res,bstring))
                self.xmlstream.send(message)
        except:
            print traceback.print_exc()
            pass

    def processor(self, elem):
        try:
            self.processMessage(elem)
        except:
            io = StringIO.StringIO()
            traceback.print_exc(file=io)
            print io.getvalue()
            msg = MIMEText("%s\n\n%s\n\n"%(elem.toXml(), io.getvalue() ))
            msg['subject'] = 'iembot Traceback'
            msg['From'] = "ldm@mesonet.agron.iastate.edu"
            msg['To'] = "akrherz@iastate.edu"

            s = smtplib.SMTP()
            s.connect()
            s.sendmail(msg["From"], msg["To"], msg.as_string())
            s.close()

    def processMessage(self, elem):
        t = ""
        try:
            t = elem["type"]
        except:
            print elem.toXml(), 'BOOOOOOO'

        bstring = xpath.queryForString('/message/body', elem)
        if (bstring == ""):
            return

        if (t == "groupchat"):
            self.processMessageGC(elem)

        elif (t == "chat" or t == ""):
            self.processMessagePC(elem)

    def talkWithUser(self, elem):
        _from = jid.JID( elem["from"] )
        message = domish.Element(('jabber:client','message'))
        message['to'] = elem['from']
        message['type'] = "chat"
        message.addElement('body',None,"Sorry, I won't talk back to you yet!")
        self.xmlstream.send(message)

    def processMessagePC(self, elem):
        _from = jid.JID( elem["from"] )

        if (_from.userhost() != "iembot_ingest@%s" % (CHATSERVER,) ):
           self.talkWithUser(elem)
           return

        """ Go look for body to see routing info! """
        wfo = None
        # Get the body string
        bstring = xpath.queryForString('/message/body', elem)
        htmlstr = xpath.queryForString('/message/html/body', elem)
        if (len(bstring) < 3):
            print "BAD!!!"
            return
        wfo = bstring[:3]
        # Look for HTML
        html = xpath.queryForNodes('/message/html', elem)

        # Route message to botstalk room in tact
        message = domish.Element(('jabber:client','message'))
        message['to'] = "botstalk@conference.%s" % (CHATSERVER,)
        message['type'] = "groupchat"
        message.addChild( elem.body )
        if (elem.html):
            message.addChild(elem.html)
        self.xmlstream.send(message)

        # Send to chatroom, clip body
        message = domish.Element(('jabber:client','message'))
        message['to'] = "%schat@conference.%s" % (wfo.lower(), CHATSERVER,)
        message['type'] = "groupchat"
        message.addElement('body',None,bstring[4:])
        if (elem.html):
            message.addChild(elem.html)

        self.xmlstream.send(message)
        if (wfo.upper() == "TBW" or wfo.upper() == "MLB"):
            message['to'] = "%semchat@conference.%s" % (wfo.lower(), CHATSERVER)
            self.xmlstream.send(message)
        if (wfo.upper() == "BMX" or wfo.upper() == "FWD"):
            message['to'] = "%semachat@conference.%s" % (wfo.lower(), CHATSERVER)
            self.xmlstream.send(message)
        if (wfo.upper() == "BMX" or wfo.upper() == "HUN"):
            message['to'] = "abc3340@conference.%s" % ( CHATSERVER,)
            self.xmlstream.send(message)
        if (wfo.upper() == "MOB" or wfo.upper() == "TAE" or wfo.upper() == "BMX"):
            message['to'] = "vipir6and7@conference.%s" % ( CHATSERVER,)
            self.xmlstream.send(message)
        if (wfo.upper() == "FFC"):
            message['to'] = "wxiaweather@conference.%s" % ( CHATSERVER,)
            self.xmlstream.send(message)
        if (wfo.upper() == "JAN"):
            message['to'] = "janhydrochat@conference.%s" % ( CHATSERVER,)
            self.xmlstream.send(message)
        if (wfo.upper() == "DMX"):
            message['to'] = "%semchat@conference.%s" % (wfo.lower(), CHATSERVER)
            self.xmlstream.send(message)
            message['to'] = "kccichat@conference.%s" % (CHATSERVER,)
            self.xmlstream.send(message)

myJid = jid.JID('iembot@%s/twisted_words' % (CHATSERVER,) )
factory = client.basicClientFactory(myJid, IEMCHAT_PASS)

jabber = JabberClient(myJid)

factory.addBootstrap('//event/stream/authd',jabber.authd)
#factory.addBootstrap("//event/client/basicauth/invaliduser", jabber.failure)
#factory.addBootstrap("//event/client/basicauth/authfailed", jabber.failure)
#factory.addBootstrap("//event/stream/error", jabber.failure)

#reactor.connectTCP(CHATSERVER,5222,factory)
reactor.connectTCP('localhost',5222,factory)

xmlrpc = IEMChatXMLRPC()
reactor.listenTCP(8002, server.Site(xmlrpc))

reactor.run()

<|endoftext|>


<commit_before>"""
FinalProject.py
Author: Liam S
Credit:
"""
from ggame import App, Sprite, ImageAsset, Frame
from ggame import SoundAsset, Sound, TextAsset, Color
import math
from time import time

class Background(Sprite):

    asset = ImageAsset("images/grass_with_blue_sky_by_devrez-d35pm8j.png")
    width = 1032
    height = 774

    def __init__(self, position):
        super().__init__(Background.asset, position)
        self.scale = 1.4

class Truck(Sprite):

    asset = ImageAsset("images/Truck-side-edit copy.png")
    width = 1389
    height = 664

    def __init__(self, position):
        super().__init__(Truck.asset, position)
        self.scale = 1
        self.rectangularCollisionModel()

    def step(self):
        self.x -= 2
        if self.x <= -180:
            self.x = 1999
        if self.collidingWithSprites(Bomb):
            self.visible = False

class Ship(Sprite):

    asset = ImageAsset("images/il2m3-bp-fl-am-3view-mongolian.png")

    def __init__(self, position):
        super().__init__(Ship.asset, position)
        self.vx = 1
        self.vy = 1
        self.vAddedx = 0
        self.vAddedy = 0
        self.vAddedr = 0
        self.vertThrust = 0
        self.RotThrust = 0
        self.thrustframe = 1
        self.scale = 0.25
        """
        PlaneGame.listenKeyEvent("keydown", "left arrow", self.thrustLeft)
        PlaneGame.listenKeyEvent("keyup", "right arrow", self.thrustRightoff)
        PlaneGame.listenKeyEvent("keyup", "left arrow", self.thrustLeftoff)
        PlaneGame.listenKeyEvent("keydown", "right arrow", self.thrustRight)
        """
        PlaneGame.listenKeyEvent("keydown", "up arrow", self.thrustUp)
        PlaneGame.listenKeyEvent("keyup", "down arrow", self.thrustDownoff)
        PlaneGame.listenKeyEvent("keyup", "up arrow", self.thrustUpoff)
        PlaneGame.listenKeyEvent("keydown", "down arrow", self.thrustDown)

        self.fxcenter = self.fycenter = 0.5
    def step(self):
        """
        if self.sideThrust == 1:
            self.vAddedx += 0.05
        if self.sideThrust == -1:
            self.vAddedx -= 0.05
        if self.sideThrust == 0:
            self.vAddedx += 0
        """
        if self.vertThrust == 1:
            self.vAddedy = 1.3
        if self.vertThrust == -1:
            self.vAddedy = -1.3
        if self.vertThrust == 0:
            self.vAddedy = 0
        if self.RotThrust == 1:
            self.vAddedr = -0.3
        if self.RotThrust == -1:
            self.vAddedr = 0.3
        if self.RotThrust == 0:
            self.vAddedr = 0
        if self.x >= 2000:
            self.x = 10
        if self.x <= 0:
            self.x = 1999
        if self.y <=10:
            self.y = 11
        self.x += 5
        self.y += self.vAddedy
        self.rotation = self.vAddedr
        if self.y >= 765:
            self.visible = False

    def thrustUp(self, event):
        self.vertThrust = -1
        self.RotThrust = -1

    def thrustDown(self, event):
        self.vertThrust = 1
        self.RotThrust = 1

    def thrustDownoff(self, event):
        self.vertThrust = 0
        self.RotThrust = 0

    def thrustUpoff(self, event):
        self.vertThrust = 0
        self.RotThrust = 0

class Bomb(Sprite):

    asset = ImageAsset("images/bomb.png")
    width = 2000
    height = 1000

    def __init__(self, position, ship):
        super().__init__(Bomb.asset, position)
        self.scale = 0.04
        self.ship = ship
        self.visible = False
        self.dropped = False
        self.counter = 0
        PlaneGame.listenKeyEvent("keydown", "space", self.dropBomb)
        self.circularCollisionModel()

    def dropBomb(self, event):
        self.dropped = True

    def nodropBomb(self, event):
        self.dropped = False

    def step(self):
        if self.dropped == False:
            self.x = self.ship.x
            self.y = self.ship.y+15
        if self.dropped == True:
            self.visible = True
            if self.visible == True:
                self.counter += 0.2
                self.x += 5
                self.y += self.counter
        if self.y >= 765 or self.collidingWithSprites(Truck):
            self.visible = False
            self.dropped = False
            self.counter = 0
            ExplosionBig(self.position)
        if self.x >= 2000:
            self.x = 10
        if self.x <= 0:
            self.x = 1999

class ExplosionBig(Sprite):

    asset = ImageAsset("images/explosion2.png", Frame(0,0,4800/25,195), 25)

    def __init__(self, position):
        super().__init__(ExplosionBig.asset, position)
        self.image = 0
        self.center = (0.5, 0.5)
        self.scale = 0.7

    def step(self):
        self.setImage(self.image//2)  # slow it down
        self.image = self.image + 1
        if self.image == 50:
            self.destroy()

class PlaneGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Background((0, 0))
        Background((1300, 0))
        Background((2000, 0))
        s = Ship((400,200))
        Bomb((400,600),s)
        Truck((200,715))

    def step(self):
        for ship in self.getSpritesbyClass(Ship):
            ship.step()
        for ship in self.getSpritesbyClass(Bomb):
            ship.step()
        for ship in self.getSpritesbyClass(ExplosionBig):
            ship.step()
        for ship in self.getSpritesbyClass(Truck):
            ship.step()

app = PlaneGame(0,0)
app.run()

<commit_msg>Updated from Brython Server: 12/13/2016 1:58:11 PM<commit_after>"""
FinalProject.py
Author: Liam S
Credit:
"""
from ggame import App, Sprite, ImageAsset, Frame
from ggame import SoundAsset, Sound, TextAsset, Color
import math
from time import time

class Background(Sprite):

    asset = ImageAsset("images/grass_with_blue_sky_by_devrez-d35pm8j.png")
    width = 1032
    height = 774

    def __init__(self, position):
        super().__init__(Background.asset, position)
        self.scale = 1.4

class Truck(Sprite):

    asset = ImageAsset("images/Truck-side-edit copy.png")
    width = 1389
    height = 664

    def __init__(self, position):
        super().__init__(Truck.asset, position)
        self.scale = 1
        self.rectangularCollisionModel()

    def step(self):
        self.x -= 2
        if self.x <= -180:
            self.x = 1999
        #if self.collidingWithSprites(Bomb):
         #   self.visible = False

class Ship(Sprite):

    asset = ImageAsset("images/il2m3-bp-fl-am-3view-mongolian.png")

    def __init__(self, position):
        super().__init__(Ship.asset, position)
        self.vx = 1
        self.vy = 1
        self.vAddedx = 0
        self.vAddedy = 0
        self.vAddedr = 0
        self.vertThrust = 0
        self.RotThrust = 0
        self.thrustframe = 1
        self.scale = 0.25
        """
        PlaneGame.listenKeyEvent("keydown", "left arrow", self.thrustLeft)
        PlaneGame.listenKeyEvent("keyup", "right arrow", self.thrustRightoff)
        PlaneGame.listenKeyEvent("keyup", "left arrow", self.thrustLeftoff)
        PlaneGame.listenKeyEvent("keydown", "right arrow", self.thrustRight)
        """
        PlaneGame.listenKeyEvent("keydown", "up arrow", self.thrustUp)
        PlaneGame.listenKeyEvent("keyup", "down arrow", self.thrustDownoff)
        PlaneGame.listenKeyEvent("keyup", "up arrow", self.thrustUpoff)
        PlaneGame.listenKeyEvent("keydown", "down arrow", self.thrustDown)

        self.fxcenter = self.fycenter = 0.5
    def step(self):
        """
        if self.sideThrust == 1:
            self.vAddedx += 0.05
        if self.sideThrust == -1:
            self.vAddedx -= 0.05
        if self.sideThrust == 0:
            self.vAddedx += 0
        """
        if self.vertThrust == 1:
            self.vAddedy = 1.3
        if self.vertThrust == -1:
            self.vAddedy = -1.3
        if self.vertThrust == 0:
            self.vAddedy = 0
        if self.RotThrust == 1:
            self.vAddedr = -0.3
        if self.RotThrust == -1:
            self.vAddedr = 0.3
        if self.RotThrust == 0:
            self.vAddedr = 0
        if self.x >= 2000:
            self.x = 10
        if self.x <= 0:
            self.x = 1999
        if self.y <=10:
            self.y = 11
        self.x += 5
        self.y += self.vAddedy
        self.rotation = self.vAddedr
        if self.y >= 765:
            self.visible = False

    def thrustUp(self, event):
        self.vertThrust = -1
        self.RotThrust = -1

    def thrustDown(self, event):
        self.vertThrust = 1
        self.RotThrust = 1

    def thrustDownoff(self, event):
        self.vertThrust = 0
        self.RotThrust = 0

    def thrustUpoff(self, event):
        self.vertThrust = 0
        self.RotThrust = 0

class Bomb(Sprite):

    asset = ImageAsset("images/bomb.png")
    width = 2000
    height = 1000

    def __init__(self, position, ship):
        super().__init__(Bomb.asset, position)
        self.scale = 0.04
        self.ship = ship
        self.visible = False
        self.dropped = False
        self.counter = 0
        PlaneGame.listenKeyEvent("keydown", "space", self.dropBomb)
        self.circularCollisionModel()

    def dropBomb(self, event):
        self.dropped = True

    def nodropBomb(self, event):
        self.dropped = False

    def step(self):
        if self.dropped == False:
            self.x = self.ship.x
            self.y = self.ship.y+15
        if self.dropped == True:
            self.visible = True
            if self.visible == True:
                self.counter += 0.2
                self.x += 5
                self.y += self.counter
        if self.y >= 765:
            self.visible = False
            self.dropped = False
            self.counter = 0
            ExplosionBig(self.position)
        if self.x >= 2000:
            self.x = 10
        if self.x <= 0:
            self.x = 1999

class ExplosionBig(Sprite):

    asset = ImageAsset("images/explosion2.png", Frame(0,0,4800/25,195), 25)

    def __init__(self, position):
        super().__init__(ExplosionBig.asset, position)
        self.image = 0
        self.center = (0.5, 0.5)
        self.scale = 0.7

    def step(self):
        self.setImage(self.image//2)  # slow it down
        self.image = self.image + 1
        if self.image == 50:
            self.destroy()

class PlaneGame(App):
    def __init__(self, width, height):
        super().__init__(width, height)
        Background((0, 0))
        Background((1300, 0))
        Background((2000, 0))
        s = Ship((400,200))
        Bomb((400,600),s)
        Truck((200,715))

    def step(self):
        for ship in self.getSpritesbyClass(Ship):
            ship.step()
        for ship in self.getSpritesbyClass(Bomb):
            ship.step()
        for ship in self.getSpritesbyClass(ExplosionBig):
            ship.step()
        for ship in self.getSpritesbyClass(Truck):
            ship.step()

app = PlaneGame(0,0)
app.run()

<|endoftext|>