from random import random, choice

from pygame import Color, Rect
from pygame.font import Font

from ball_cup.pgfw.Animation import Animation

class Result(Animation):

    def __init__(self, parent):
        Animation.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.background_color = self.parent.color
        self.load_configuration()
        self.set_font()
        self.reset()
        self.register(self.render, self.framerate)

    def load_configuration(self):
        config = self.get_configuration("result")
        self.success_text = config["success-text"]
        self.miss_text = config["miss-text"]
        self.success_colors = self.build_color_list(config["success-colors"])
        self.miss_color = Color(config["miss-color"] + "FF")
        self.font_size = config["font-size"]
        self.margin = config["margin"]
        self.framerate = config["framerate"]
        self.main_color_probability = config["main-color-probability"]
        self.font_path = self.get_resource("result", "font-path")

    def build_color_list(self, colors):
        return [Color(color + "FF") for color in colors]

    def set_font(self):
        self.font = Font(self.font_path, self.font_size)

    def reset(self):
        self.halt(self.render)
        self.deactivate()
        self.rect = Rect(0, 0, 0, 0)

    def deactivate(self):
        self.active = False

    def render(self):
        color = self.color
        if self.text != self.miss_text:
            color = self.get_color()
        surface = self.font.render(self.text, True, color,
                                   self.background_color)
        rect = surface.get_rect()
        relative = self.display_surface.get_rect()
        rect.centerx = relative.centerx
        rect.bottom = relative.bottom - self.margin
        self.surface = surface
        self.rect = rect

    def get_color(self):
        color = self.color
        if random() > self.main_color_probability:
            colors = self.success_colors[:]
            colors.remove(self.color)
            color = choice(colors)
        return color

    def activate(self):
        self.active = True
        self.set_text()
        self.play(self.render)

    def set_text(self):
        proximity = self.parent.proximity
        if proximity is None:
            self.text = self.miss_text
            self.color = self.miss_color
        else:
            text = self.success_text
            count = len(text)
            index = min(count - 1, int(proximity * count))
            self.text = text[index]
            self.color = self.success_colors[index]

    def update(self):
        Animation.update(self)
        if self.active:
            self.draw()

    def clear(self):
        self.parent.clear(self.rect)

    def draw(self):
        self.display_surface.blit(self.surface, self.rect)
from math import sqrt

from pygame import Surface
from pygame.draw import circle
from pygame.locals import *

from ball_cup.pgfw.Animation import Animation
from ball_cup.field.Levels import Levels
from ball_cup.field.Cup import Cup
from ball_cup.field.ball.Ball import Ball
from ball_cup.field.Result import Result
from ball_cup.field.scoreboard.Scoreboard import Scoreboard

class Field(Animation):

    def __init__(self, parent):
        Animation.__init__(self, parent)
        self.delegate = self.get_delegate()
        self.display_surface = self.get_screen()
        self.level_index = 0
        self.waiting_for_key_up = False
        self.ended = False
        self.load_configuration()
        self.set_background()
        self.set_children()
        self.set_max_distance()
        self.draw()
        self.subscribe(self.respond)
        self.subscribe(self.skip, KEYDOWN)
        self.register(self.activate_result, self.submit_result,
                      self.show_game_over)

    def load_configuration(self):
        config = self.get_configuration("field")
        self.color = config["color"]
        self.result_delay = config["result-delay"]
        self.submit_delay = config["submit-delay"]
        self.game_over_delay = config["game-over-delay"]

    def set_background(self):
        background = Surface(self.display_surface.get_size())
        background.fill(self.color)
        self.background = background

    def set_children(self):
        self.levels = Levels(self)
        self.cup = Cup(self)
        self.ball = Ball(self)
        self.result = Result(self)
        self.scoreboard = Scoreboard(self)

    def set_max_distance(self):
        cup_w, cup_h = self.cup.rect.size
        ball_w, ball_h = self.ball.rect.size
        limit = cup_w / 2.0 + ball_w / 2.0 - 1, \
                cup_h / 2.0 + ball_h / 2.0 - 1
        self.max_distance = sqrt(limit[0] ** 2 + limit[1] ** 2)

    def draw(self):
        self.clear(self.display_surface.get_rect())

    def respond(self, event):
        compare = self.delegate.compare
        if compare(event, "reset-game"):
            self.reset()
        if compare(event, "left", cancel=True):
            if self.waiting_for_key_up:
                if self.ended:
                    self.reset()
                else:
                    self.advance_level()

    def reset(self):
        self.advance_level(0)
        self.scoreboard.reset()

    def advance_level(self, index=None):
        if index is None:
            index = self.level_index + 1
        if index >= len(self.levels):
            self.reset()
            return
        self.ended = False
        self.waiting_for_key_up = False
        self.level_index = index
        self.halt(self.activate_result)
        self.halt(self.submit_result)
        self.clear_children()
        self.cup.reset()
        self.ball.reset()
        self.result.reset()
        self.set_max_distance()

    def skip(self, event):
        if self.check_command_line("sk"):
            if event.key == K_UP:
                self.advance_level()
                self.halt()
            elif event.key == K_DOWN:
                self.advance_level(self.level_index - 1)
                self.halt()
            elif event.key == K_RIGHT:
                self.advance_level(self.level_index)
                self.halt()

    def get_current_level(self):
        return self.levels[self.level_index]

    def evaluate(self):
        proximity = None
        cr = self.cup.rect
        br = self.ball.rect
        if br.colliderect(cr):
            target = cr.left + cr.w / 2.0, cr.top + cr.h / 2.0
            position = br.left + br.w / 2.0, br.top + br.h / 2.0
            distance = sqrt((position[0] - target[0]) ** 2 + \
                            (position[1] - target[1]) ** 2)
            proximity = 1 - (distance / self.max_distance)
            self.play(self.submit_result, delay=self.submit_delay,
                      play_once=True)
        else:
            self.play(self.show_game_over, delay=self.game_over_delay,
                      play_once=True)
        self.proximity = proximity
        self.play(self.activate_result, delay=self.result_delay, play_once=True)

    def activate_result(self):
        self.result.activate()
        if self.proximity is None:
            self.scoreboard.reset()

    def submit_result(self):
        self.scoreboard.refresh()
        self.waiting_for_key_up = True

    def show_game_over(self):
        self.ended = True
        self.waiting_for_key_up = True

    def update(self):
        self.clear_children()
        Animation.update(self)
        self.cup.update()
        self.ball.update()
        self.result.update()
        self.scoreboard.update()

    def clear_children(self):
        self.cup.clear()
        self.ball.clear()
        self.result.clear()
        self.scoreboard.clear()

    def clear(self, rect):
        self.display_surface.blit(self.background, rect, rect)
3.144.200.239
3.144.200.239
3.144.200.239
 
March 3, 2021

Video 📺

Computers are a gun. They can see the target; they can pull the trigger. Computers were made by the military to blow people's brains out if they stepped out of line. Google Coral is the same technology that pollutes the oceans, and so is the computer I'm using, and so are the platforms I'm using to post this.

Game 🎲

Games are a context in which all play is purposeful. Games expose the fundamentally nihilistic nature of the universe and futility of pursuing any path other than the inevitability of death and the torture of an evil that knows and exploits absolute freedom. Games are not educational; they are education.

Propaganda 🆒

Education is propaganda — ego driven by-product conveying nothing that would enable us to expose that vanities made for gain subject us further to an illusion created by those in control: the illusion that quantity can represent substance and that data or observation can replace meaning. And why say it, or how, without contradicting yourself, that everything, once registered, no longer exists, and in fact never did, exists only in relation to other non-existent things, and when you look, it's not there, not only because it's long vanished, but because where would it be?


fig. 2: Gamer goo is a lubricant — not for your skin, but for facilitating your ability to own the competition (image from Gamer goo review)

As a result of video games, the great Trojan horse 🎠 of imperialist consumerist representationalism, people are divided in halves to encourage them to act according to market ordained impulses, to feign assurance, penetrating themselves deeper into a tyranny from which every action signals allegiance, confusing the world with definitions and borders, constantly struggling to balance or brace themselves against forces that threaten the crumbling stability of their ego.

F

or example, a cup 🥃 is designed and built to hold something, maintain order and prevent chaos. It keeps water from spilling back to where it belongs, back where it wants to go and gravity wants it to go. The cup is a trap, and it is used to assert dominance over nature, to fill with thoughts about existence, time and self, thoughts regarding dissimilarity between equal parts and patterns that manifest in variation. These ruminations disguised as revelations boil away to reveal isolated and self-aggrandizing thoughts about an analogy fabricated to herald the profundity of one's campaign's propaganda. You have no authentic impulse except to feed a delusion of ultimate and final supremacy. That is why you play games. That is your nature. That is why you eventually smash the cup to bits 💥 or otherwise watch it disintegrate forever because it, by being useful, threatens your facade of ownership and control.


fig. 3: worth1000

The cup is you; it reflects you; it is a lens through which you see yourself; it reassures you, confirming your presence; it says something, being something you can observe. When you move, it moves, and it opens after being closed. You can use it as a vessel for penetration fantasies, keeping you warm and fertile, a fine host for the plague of consciousness, you reptile, you sun scorched transgressor that not only bites the hand that feeds, but buries it deep within a sterile chamber where nothing remains for it as a means of escape except the corpses of others that infringed upon your feeding frenzy.