<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Albert</title>
    <description>The latest articles on DEV Community by Albert (@albert_001ae66d1b1278b0ab).</description>
    <link>https://dev.to/albert_001ae66d1b1278b0ab</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3214986%2Fb9180a7d-0a36-435c-b5e6-f87702e9d4f3.png</url>
      <title>DEV Community: Albert</title>
      <link>https://dev.to/albert_001ae66d1b1278b0ab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/albert_001ae66d1b1278b0ab"/>
    <language>en</language>
    <item>
      <title>How to build a mouth calendar by Python?</title>
      <dc:creator>Albert</dc:creator>
      <pubDate>Tue, 19 Aug 2025 02:50:02 +0000</pubDate>
      <link>https://dev.to/albert_001ae66d1b1278b0ab/how-to-4p8k</link>
      <guid>https://dev.to/albert_001ae66d1b1278b0ab/how-to-4p8k</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F65accnxmkocbiw50x8v7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F65accnxmkocbiw50x8v7.png" alt=" " width="800" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93zgxhv8lp4t56vkkdfo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93zgxhv8lp4t56vkkdfo.png" alt=" " width="800" height="565"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import calendar
from pathlib import Path
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.patches import Rectangle

matplotlib.use("Agg")

def draw_pretty_calendar_grid(
    year,
    month,
    week_start="mon",
    title=None,
    landscape=True,
    dpi=300,
    outdir=Path("."),
    fmts=["pdf", "png"],
    style="classic",
    draw_grid=True,
):
    a4_w, a4_h = 8.27, 11.69
    if landscape:
        a4_w, a4_h = a4_h, a4_w

    fig, ax = plt.subplots(figsize=(a4_w, a4_h), dpi=dpi)
    ax.set_axis_off()

    margin = 0.05
    fig.subplots_adjust(left=margin, right=1-margin, top=1-margin, bottom=margin)

    _title = title or f"{calendar.month_name[month]} {year}"
    title_color = "#2E8B57"
    title_fontsize = 36
    title_rel_height = title_fontsize / (dpi * a4_h)

    ax.text(
        0.5,
        1.0,
        _title,
        ha="center",
        va="top",
        fontsize=title_fontsize,
        fontweight="bold",
        color=title_color,
        transform=ax.transAxes,
    )

    blank_height = 0.04
    weekday_height = 0.06
    n_cols = 7
    labels = list(calendar.day_abbr)
    firstweekday = 0 if week_start == "mon" else 6
    calendar.setfirstweekday(firstweekday)
    if week_start != "mon":
        labels = labels[-1:] + labels[:-1]

    y_weekday_bottom = 1.0 - margin - title_rel_height - weekday_height + 0.02 * weekday_height
    for c, day in enumerate(labels):
        x_pos = c / n_cols + 0.02 / n_cols
        ax.text(
            x_pos,
            y_weekday_bottom,
            day,
            ha="left",
            va="bottom",
            fontsize=20,
            fontweight="bold",
            transform=ax.transAxes,
        )

    month_matrix = calendar.monthcalendar(year, month)
    n_rows = len(month_matrix)
    calendar_space = 1.0 - margin - title_rel_height - weekday_height - blank_height
    cell_h = calendar_space / n_rows
    cell_w = 1.0 / n_cols
    x0, y0 = 0, 0

    for r, week in enumerate(month_matrix):
        for c, day in enumerate(week):
            if day != 0:
                x_left = x0 + c * cell_w
                y_bottom = y0 + (n_rows - r - 1) * cell_h
                weekend_color = "#D3D3D3"
                weekend_cols = [5, 6] if week_start == "mon" else [6, 0]
                if c in weekend_cols:
                    rect = Rectangle(
                        (x_left, y_bottom),
                        cell_w,
                        cell_h,
                        facecolor=weekend_color,
                        edgecolor=None,
                        transform=ax.transAxes,
                        zorder=0,
                    )
                    ax.add_patch(rect)

                padding_x = 0.05 * cell_w
                padding_y = 0.05 * cell_h
                x_pos = x0 + c * cell_w + padding_x
                y_pos = y0 + (n_rows - r - 1) * cell_h + cell_h - padding_y
                ax.text(
                    x_pos,
                    y_pos,
                    str(day),
                    ha="left",
                    va="top",
                    fontsize=20,
                    transform=ax.transAxes,
                )
    if draw_grid:
        for r, week in enumerate(month_matrix):
            for c, day in enumerate(week):
                x_left = x0 + c * cell_w
                y_bottom = y0 + (n_rows - r - 1) * cell_h
                rect = Rectangle(
                    (x_left, y_bottom),
                    cell_w,
                    cell_h,
                    fill=False,
                    edgecolor="black",
                    lw=0.8,
                    transform=ax.transAxes
                )
                ax.add_patch(rect)

    outdir.mkdir(parents=True, exist_ok=True)
    grid_tag = "grid" if draw_grid else "line"
    stem = f"calendar_{year}_{month:02d}_{style}{'_landscape' if landscape else ''}_{grid_tag}"

    for f in fmts:
        path = outdir / f"{stem}.{f}"
        fig.savefig(path, dpi=dpi)
        print(f"Saved -&amp;gt; {path.resolve()}")

    plt.close(fig)

draw_pretty_calendar_grid(2025, 8, style="colorful", fmts=["png"], draw_grid=False)
draw_pretty_calendar_grid(2025, 8, style="colorful", fmts=["png"], draw_grid=True)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>calander</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Build a Simple “Jump Jump” Game in Under 100 Lines of JavaScript</title>
      <dc:creator>Albert</dc:creator>
      <pubDate>Tue, 27 May 2025 17:02:59 +0000</pubDate>
      <link>https://dev.to/albert_001ae66d1b1278b0ab/build-a-simple-jump-jump-game-in-under-100-lines-of-javascript-40g3</link>
      <guid>https://dev.to/albert_001ae66d1b1278b0ab/build-a-simple-jump-jump-game-in-under-100-lines-of-javascript-40g3</guid>
      <description>&lt;p&gt;“Jump Jump” is a super addictive mini-game where you control a block that jumps from one platform to another by charging up jump power. &lt;/p&gt;

&lt;p&gt;The longer you hold, the farther it jumps. It’s simple but challenging, and perfect for quick fun.&lt;/p&gt;

&lt;p&gt;How It Works&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press and hold the mouse (or screen) to charge jump power&lt;/li&gt;
&lt;li&gt;Release to make the block jump forward&lt;/li&gt;
&lt;li&gt;The goal is to land safely on the next platform&lt;/li&gt;
&lt;li&gt;Miss a jump and the game is over&lt;/li&gt;
&lt;li&gt;Each successful jump increases your score and spawns a new platform
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8" /&amp;gt;
  &amp;lt;title&amp;gt;Simple Jump Jump Game&amp;lt;/title&amp;gt;
  &amp;lt;style&amp;gt;
    body {
      margin: 0; 
      overflow: hidden; 
      background: #222; 
      display: flex; 
      justify-content: center; 
      align-items: center; 
      height: 100vh;
    }
    canvas {
      background: #333; 
      border-radius: 10px;
      display: block;
    }
  &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;canvas id="game" width="400" height="600"&amp;gt;&amp;lt;/canvas&amp;gt;
  &amp;lt;script&amp;gt;
    const canvas = document.getElementById('game');
    const ctx = canvas.getContext('2d');

    // Game variables
    let platforms = [{ x: 150, y: 550, width: 100 }];
    let player = { x: 190, y: 530, size: 20 };
    let nextPlatform = { x: 0, y: 0, width: 0 };
    let isCharging = false;
    let chargeStart = 0;
    let jumpPower = 0;
    let score = 0;
    let isJumping = false;
    let jumpProgress = 0;
    let jumpStart = { x: 0, y: 0 };
    let jumpEnd = { x: 0, y: 0 };

    // Generate a new platform at a random distance and height
    function newPlatform() {
      const minGap = 80, maxGap = 150;
      const gap = Math.random() * (maxGap - minGap) + minGap;
      const width = Math.random() * 60 + 60;
      const last = platforms[platforms.length -1];
      nextPlatform.x = last.x + gap;
      nextPlatform.y = 550 - Math.random() * 100;
      nextPlatform.width = width;
      platforms.push({...nextPlatform});
    }

    // Draw game objects
    function draw() {
      ctx.clearRect(0, 0, canvas.width, canvas.height);

      // Draw platforms
      ctx.fillStyle = '#5ac';
      platforms.forEach(p =&amp;gt; {
        ctx.fillRect(p.x, p.y, p.width, 10);
      });

      // Draw player block
      ctx.fillStyle = 'yellow';
      ctx.fillRect(player.x, player.y, player.size, player.size);

      // Draw score
      ctx.fillStyle = 'white';
      ctx.font = '20px Arial';
      ctx.fillText(`Score: ${score}`, 10, 30);

      // Draw charge bar when charging
      if (isCharging) {
        ctx.fillStyle = 'red';
        ctx.fillRect(50, 50, jumpPower * 200, 10);
      }
    }

    // Update game state each frame
    function update() {
      if (isJumping) {
        jumpProgress += 0.05;
        if (jumpProgress &amp;gt;= 1) {
          jumpProgress = 1;
          isJumping = false;
          // Check if player landed on a platform
          const landed = platforms.some(p =&amp;gt; {
            return player.x + player.size / 2 &amp;gt; p.x &amp;amp;&amp;amp;
                   player.x + player.size / 2 &amp;lt; p.x + p.width &amp;amp;&amp;amp;
                   Math.abs(player.y + player.size - p.y) &amp;lt; 10;
          });
          if (landed) {
            score++;
            newPlatform();
            // Shift platforms so player stays roughly centered
            const shiftX = nextPlatform.x - player.x;
            platforms = platforms.map(p =&amp;gt; ({x: p.x - shiftX, y: p.y, width: p.width}));
            player.x -= shiftX;
          } else {
            alert(`Game Over! Your score: ${score}`);
            // Reset game
            platforms = [{ x: 150, y: 550, width: 100 }];
            player = { x: 190, y: 530, size: 20 };
            score = 0;
          }
        } else {
          // Calculate jump trajectory (parabola)
          player.x = jumpStart.x + (jumpEnd.x - jumpStart.x) * jumpProgress;
          const peak = 150; // jump height
          player.y = jumpStart.y + (jumpEnd.y - jumpStart.y) * jumpProgress - peak * Math.sin(Math.PI * jumpProgress);
        }
      }
    }

    // Main game loop
    function gameLoop() {
      update();
      draw();
      requestAnimationFrame(gameLoop);
    }

    // Input handlers
    canvas.addEventListener('mousedown', () =&amp;gt; {
      if (!isJumping) {
        isCharging = true;
        chargeStart = Date.now();
        jumpPower = 0;
      }
    });

    canvas.addEventListener('mouseup', () =&amp;gt; {
      if (isCharging) {
        isCharging = false;
        jumpPower = Math.min((Date.now() - chargeStart) / 500, 1);
        isJumping = true;
        jumpProgress = 0;
        jumpStart = { x: player.x, y: player.y };
        jumpEnd = { 
          x: player.x + jumpPower * 200, 
          y: platforms[platforms.length - 1].y - player.size 
        };
      }
    });

    // Charge power update loop
    function chargeLoop() {
      if (isCharging) {
        jumpPower = Math.min((Date.now() - chargeStart) / 500, 1);
      }
      setTimeout(chargeLoop, 16);
    }

    // Start the game
    newPlatform();
    gameLoop();
    chargeLoop();
  &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Want a Faster, More Intense Jumping Challenge?&lt;br&gt;
If you enjoyed this mini-game, you’ll love &lt;a href="https://geometrydash-meltdown.org/" rel="noopener noreferrer"&gt;Geometry Dash Meltdown&lt;/a&gt; — a rhythm-based platformer where every jump is synced with music, and every level tests your reflexes to the max.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>gamedev</category>
    </item>
  </channel>
</rss>
