Overview

You’re given a tabular dataset with several numeric columns and a label. Your job is to reveal a hidden hint via PCA, then use that hint to locate and decode the flag.


Phase 1 — Reveal the Hint with PCA (the “MIDDLE ZERO” text)

What to do (explanation only)

Code snippet — PCA + visualization

# Phase 1: PCA reveal
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA

# Load data
df = pd.read_csv("dataset_new.csv")

# Split features vs. label (drop the label column)
feature_cols = [c for c in df.columns if c != "label"]
X = df[feature_cols].values
y = df["label"].values

# 2D PCA
pca = PCA(n_components=2)
X_pca = pca.fit_transform(X)

# Plot: color by label, highlight label==0 (the text)
plt.figure(figsize=(10, 7))
colors = {0: "red", 1: "lightblue", 2: "lightgreen"}
for lab in sorted(np.unique(y)):
    mask = (y == lab)
    size = 30 if lab == 0 else 6
    alpha = 0.95 if lab == 0 else 0.25
    edge = "black" if lab == 0 else None
    lw = 0.4 if lab == 0 else 0
    plt.scatter(X_pca[mask, 0], X_pca[mask, 1],
                c=colors.get(lab, "gray"), s=size, alpha=alpha,
                edgecolors=edge, linewidth=lw, label=f"label={lab}")

plt.title('PCA – Look for the "MIDDLE ZERO" hint in label=0')
plt.xlabel("PC1"); plt.ylabel("PC2")
plt.legend(); plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig("pca_middle_zero.png", dpi=220)
plt.show()

image.png


Phase 2 — Extract & Decode the Flag (“middle column e where label == 0”)

What to do (explanation only)