from pygame import Surface, Color, Rect
from pygame.time import get_ticks

from ball_cup.pgfw.Animation import Animation

class Charge(Animation, Surface):

    def __init__(self, parent):
        Animation.__init__(self, parent, self.flash)
        self.display_surface = self.get_display_surface()
        self.input = self.get_input()
        self.load_configuration()
        self.register(self.flash, interval=self.interval)
        self.init_surface()
        self.reset()
        self.play()

    def load_configuration(self):
        config = self.get_configuration("charge")
        self.transparent_color = config["transparent-color"]
        self.peak_time = config["peak-time"]
        self.colors = self.build_color_list(config["colors"])
        self.width = config["width"]
        self.interval = config["interval"]
        self.magnitude_range = config["magnitude-range"]

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

    def init_surface(self):
        Surface.__init__(self, (self.width, self.magnitude_range[1] * 2))
        self.set_colorkey(self.transparent_color)
        self.fill(self.transparent_color)
        rect = self.get_rect()
        rect.centery = self.display_surface.get_rect().centery
        self.rect = rect

    def reset(self):
        self.cancel()
        self.set_strength()
        self.color_index = 0

    def cancel(self):
        self.start = None
        self.fill(self.transparent_color)

    def set_strength(self):
        strength = 0
        if self.start:
            peak = self.peak_time
            elapsed = (get_ticks() - self.start) % peak
            strength = min(1, float(elapsed) / peak)
        self.strength = strength

    def is_charging(self):
        return self.start is not None

    def flash(self):
        if self.is_charging():
            self.increment_color_index()
            self.fill(self.transparent_color)
            self.fill(self.colors[self.color_index], self.get_fill_section())

    def get_fill_section(self):
        lower, upper = self.magnitude_range
        magnitude = self.strength * (upper - lower) + lower
        rect = Rect(0, 0, self.get_width(), magnitude * 2)
        rect.top = self.get_height() / 2 - magnitude
        return rect

    def increment_color_index(self):
        index = self.color_index + 1
        if index >= len(self.colors):
            index = 0
        self.color_index = index

    def update(self):
        self.check_input()
        self.set_strength()
        self.clear()
        Animation.update(self)
        self.draw()

    def check_input(self):
        pressed = self.input.is_command_active("left")
        charging = self.is_charging()
        if not pressed:
            if charging:
                self.release()
        elif pressed and not charging:
            self.hold()

    def release(self):
        self.parent.send()
        self.cancel()

    def hold(self):
        self.start = get_ticks()

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

    def draw(self):
        self.display_surface.blit(self, self.rect)
from ball_cup.pgfw.GameChild import GameChild
from ball_cup.field.scoreboard.Score import Score

class Scoreboard(GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.display_surface = self.get_display_surface()
        self.load_configuration()
        self.set_scores()
        self.reset()

    def load_configuration(self):
        config = self.get_configuration("scoreboard")
        self.height = config["height"]
        self.segment_width = config["score-segment-width"]
        self.margin_top = config["margin-top"]
        self.border_width = config["score-border-width"]
        self.border_color = config["score-border-color"]

    def set_scores(self):
        display_surface = self.get_display_surface()
        height = self.height
        segment_width = self.segment_width
        colors = self.parent.result.success_colors
        border_width = self.border_width
        border_color = self.border_color
        centerx = display_surface.get_rect().centerx
        margin = self.margin_top
        self.scores = [Score(self, display_surface, height, segment_width,
                             colors, border_width, border_color, centerx,
                             margin),
                       Score(self, display_surface, height, segment_width,
                             colors, border_width, border_color, centerx,
                             display_surface.get_height() - height - margin)]

    def reset(self):
        for score in self.scores:
            score.reset()

    def refresh(self):
        for score in self.scores:
            score.insert(self.parent.result.color)

    def update(self):
        for score in self.scores:
            score.draw()

    def clear(self):
        for score in self.scores:
            self.parent.clear(score.rect)
from pygame import Surface

from ball_cup.pgfw.GameChild import GameChild

class Score(Surface, GameChild):

    def __init__(self, parent, display_surface, height, segment_width, colors,
                 border_width, border_color, centerx, top):
        GameChild.__init__(self, parent)
        self.display_surface = display_surface
        self.height = height
        self.segment_width = segment_width
        self.colors = colors
        self.border_width = border_width
        self.border_color = border_color
        self.centerx = centerx
        self.top = top
        self.reset()
        self.populate()

    def reset(self):
        counts = []
        for color in self.colors:
            counts.append([color, 0])
        self.draw_counts = counts
        self.populate()

    def populate(self):
        self.init_surface()
        self.fill_borders()
        self.fill_center()

    def init_surface(self):
        Surface.__init__(self, (self.measure_length(),
                                self.height + self.border_width * 2))
        rect = self.get_rect()
        rect.centerx = self.centerx
        rect.top = self.top
        self.rect = rect

    def measure_length(self):
        length = 0
        for color, count in self.draw_counts:
            length += count * self.segment_width
        return length + self.border_width * 2

    def fill_borders(self):
        color = self.border_color
        rect = self.rect
        thickness = self.border_width
        self.fill(color, (0, 0, rect.w, thickness))
        self.fill(color, (rect.w - thickness, 0, thickness, rect.h))
        self.fill(color, (0, rect.h - thickness, rect.w, thickness))
        self.fill(color, (0, 0, thickness, rect.h))

    def fill_center(self):
        offset = self.border_width
        size = self.segment_width / 2, self.get_height() - offset * 2
        right = self.rect.w
        indent = offset
        for color in self.colors:
            for _ in range(self.get_draw_count(color)):
                self.fill(color, ((indent, offset), size))
                self.fill(color, ((right - indent - size[0], offset), size))
                indent += size[0]

    def get_draw_count(self, key):
        for color, count in self.draw_counts:
            if key == color:
                return count

    def insert(self, color):
        counts = self.draw_counts
        for ii in range(len(counts)):
            if counts[ii][0] == color:
                counts[ii][1] += 1
        self.populate()

    def draw(self):
        self.display_surface.blit(self, self.rect)
216.73.216.91
216.73.216.91
216.73.216.91
 
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.