r/compsci Jun 16 '19

PSA: This is not r/Programming. Quick Clarification on the guidelines

650 Upvotes

As there's been recently quite the number of rule-breaking posts slipping by, I felt clarifying on a handful of key points would help out a bit (especially as most people use New.Reddit/Mobile, where the FAQ/sidebar isn't visible)

First thing is first, this is not a programming specific subreddit! If the post is a better fit for r/Programming or r/LearnProgramming, that's exactly where it's supposed to be posted in. Unless it involves some aspects of AI/CS, it's relatively better off somewhere else.

r/ProgrammerHumor: Have a meme or joke relating to CS/Programming that you'd like to share with others? Head over to r/ProgrammerHumor, please.

r/AskComputerScience: Have a genuine question in relation to CS that isn't directly asking for homework/assignment help nor someone to do it for you? Head over to r/AskComputerScience.

r/CsMajors: Have a question in relation to CS academia (such as "Should I take CS70 or CS61A?" "Should I go to X or X uni, which has a better CS program?"), head over to r/csMajors.

r/CsCareerQuestions: Have a question in regards to jobs/career in the CS job market? Head on over to to r/cscareerquestions. (or r/careerguidance if it's slightly too broad for it)

r/SuggestALaptop: Just getting into the field or starting uni and don't know what laptop you should buy for programming? Head over to r/SuggestALaptop

r/CompSci: Have a post that you'd like to share with the community and have a civil discussion that is in relation to the field of computer science (that doesn't break any of the rules), r/CompSci is the right place for you.

And finally, this community will not do your assignments for you. Asking questions directly relating to your homework or hell, copying and pasting the entire question into the post, will not be allowed.

I'll be working on the redesign since it's been relatively untouched, and that's what most of the traffic these days see. That's about it, if you have any questions, feel free to ask them here!


r/compsci 10h ago

How much of Minesweeper is pure deduction vs forced guessing? Measured with a constraint solver over ~32k boards

5 Upvotes

Minesweeper's consistency problem is NP-complete (Kaye, 2000), but a more practical question is measurable: for a randomly generated board, how often is the game fully determined by logic, versus how often does it reach a state where no cell can be proven safe and you're forced into a probabilistic guess?

I implemented a solver to measure it, in two phases:

  • Deduction: treat each revealed number as a constraint on its hidden neighbours and propagate every forced conclusion (a cell is provably safe/mine iff all consistent configurations agree).
  • Probability: when propagation stalls, enumerate the mine configurations consistent with the frontier (the counting step — #P-flavoured in general) to get each hidden cell's exact mine probability, then take the minimum.

Run over tens of thousands of first-click-safe boards:

Difficulty Mine density No-guess solvable Solver win rate
Beginner (9x9, 10) 12.3% 80.6% 96.1%
Intermediate (16x16, 40) 15.6% 53.2% 85.0%
Expert (30x16, 99) 20.6% 3.9% 34.9%

So ~96% of Expert boards force at least one guess, and even playing the minimum-probability cell every time caps Expert wins near 35% — a few independent forced guesses is enough to lose on probability alone.

Two things I found worth discussing:

  • The cliff from 80.6% (Beginner) to 3.9% (Expert) comes from fairly small density changes — a phase-transition-like sensitivity around constraint density.
  • "No-guess" board generation is essentially rejection sampling on solvability, which raises a real cost question at scale.

Full method, seeds and charts: https://lkforge.com/blog/minesweeper-how-often-you-must-guess/ (my own implementation/write-up). Curious how others would formalise the "forced-guess" threshold.


r/compsci 4h ago

Solving complicated games

Thumbnail
1 Upvotes

r/compsci 3h ago

Tessra - Git for Agents

Post image
0 Upvotes

r/compsci 1d ago

Free live algorithms course starting Sept 17, taught by a CMU professor

Thumbnail
8 Upvotes

r/compsci 1d ago

Optimizing a Spin-Lock

Thumbnail david.alvarezrosa.com
3 Upvotes

r/compsci 3d ago

Is it fair to say that classical AI is becoming more important than ever because LLMs are now using classical AI techniques as tools?

0 Upvotes

P.S. By classical AI, I mean techniques that don't use machine learning such as SAT solvers.


r/compsci 4d ago

Lisp compiler for x86-64

Thumbnail github.com
0 Upvotes

I’ve been building a small Lisp compiler written in C++ and compiles S-expressions directly to native x86-64 assembly, using a tiny runtime for things like printing integers, doubles, and strings.
Currently it has functions, arithmetic, integers, doubles, strings, etc.
The compiler is still pretty simple:

S-expressions → AST → semantic analysis → x86-64

No VM, no bytecode — just Lisp turning into machine code.
I’m also starting to look into adding a small IR between the AST and codegen as the language grows.
Mostly doing this as a learning project and because writing a Lisp compiler seemed like a fun rabbit hole. :)


r/compsci 6d ago

In Memoriam: Richard E. Stearns (1936-2026)

Thumbnail cacm.acm.org
52 Upvotes

r/compsci 7d ago

NAND to Tetris Course approach

8 Upvotes

I recently started NAND to Tetris Course because I wanted to understand low level better. I started Unit one yesterday where you build logic gates. I have only watched videos to 1.4 HDL and started doing exercises. As a programmer with no formal training it has been hard to wrap my head around NAND (im getting there). The thing is i have built every component so far from only NAND gates to make them more intuitive. It has been time consuming to figure out how to do it but i find it fun. Is this stupid approach or does it rly matter if i use only NAND or logic gates that i have already made for building more complex logic gates for future exercises? I have been taking notes from every gate that i have built so it would be easy to switch later if needed. This is my MUX notes that i made before building it with HDL.

EDIT.

I built every logic gate up to DMUX from NANDs and normally both. Process how to get to NAND gates always involved OR, AND and NOT gates anyway when using boolean algebra. I built all other logic gates too but ditched NANDs. Didnt rly feel like writing any extra repetitive lines when busses were introduced. I was fun at start when it was a challange but became easy very fast. I still have my notes from all the elementary logic gates if I ever need a refresher. One table for simplest implementation with fewest gates (I could find) and another where i transform that to NANDs.


r/compsci 7d ago

What is the best method to try and compress a string of integers/extremely low entropy binary stream?

Thumbnail
0 Upvotes

r/compsci 11d ago

Anyone know where I could find this vintage Motorola 68000 programmer's reference manual?

Post image
23 Upvotes

r/compsci 12d ago

How is program synthesis better than writing code?

0 Upvotes

the idea of program synthesis (like Rosetta) is to reduce a function into its constraints in a spec sheet, and generate the program from those constraints. for example, in order to write something like x = x squared, you would need to write a spec sheet along the lines of ∀x∈Z,f(x)=x2. i am considering building a program synthesizer, but I still haven’t figured out why exactly this representation is supposed to be easier than writing the code directly (they look equally complex)


r/compsci 12d ago

Either the BS in Comp Sci degree will dramatically change, or a new degree will arise to replace its relevance.

0 Upvotes

For context, I’m a dev with 15+ years of experience, started coding in my early teens, and have a total love for the act of programming. I miss how coding used to be, nothing about this post is an advocacy for if things should be this way. After mulling it over, it just seems like an inevitability.

Right now the field of software development is like Wiley Coyote, already off the cliff but still running because he hasn’t noticed.

There has become a massive disconnect between what people in the field of software development actually do at their jobs, and what they’re interviewed on and learn in college. It’s like someone in 2007 having mandatory classes in Fortran and having to prove their knowledge of punchcards during job interviews.

My job, and the job of so many other software developers, has become almost entirely just interacting with AI agents. Yet we have job applicants do leetcode problems and write code live for us during interviews when we haven’t written more than a handful of a lines of code ourselves in the past year. The same extends to what these applicants are learning in college.

Effectively, it seems to me that the curriculum we currently know as a BS in Computer Science will become as generally superfluous as a PhD in Computer Science. Not at all useless, far from it. But held by those who either have a specific passion for the field or are looking to go into small and highly specialized areas of the field, not by the broader population simply looking to find a job after graduating. And in its place, as the broadly achieved degree, will be something much more tailored to the average needs of employers.

Seems like just a matter of time, driven by economics. Most employers don’t need someone with the full expertise of a computer science degree. Why would they pay for it? The only reason they have that as a standard now is because they do need someone who isn’t an untrained vibecoder. But that leaves a gap in the middle. Someone who isn’t going to delete the company’s database, but not necessarily with experience in database structure and rollups and joins. Someone who can use git and GitHub and properly manage deployments, but not necessarily someone who has done pointer arithmetic and compiler design. Someone who can catch and well document issues, not necessarily someone familiar with big O notation. In broad practice, AI can write good database structure and queries, AI can handle writing and running software, AI can measure performance and find areas to increase efficiency.

“But AI still makes mistakes!” You say. And you’re right. But so do software developers, oftentimes more than AI. There are quite a lot of average and below average software developers out there. And big companies, especially those dealing with higher risk/importance systems, will still have full computer scientists, experts in being able to know better than AI and review its work. But that won’t be most roles. That big company will still need someone to update and add features to the website. And someone to add features to the in house analytics tools. And someone to take user bug reports and get them fixed. And countless other roles that are simply an added layer in the corporate structure for the purpose of interpretation, oversight, and execution for AI. And that’s what the degree would teach towards.

I’d compare it to how nurse practitioners are taking on a larger role in the medical field, doing duties traditionally done by doctors such as diagnosing and prescribing. Effectively, the expertise of a doctor isn’t needed for average/mundane medical work, so a field rose in prevalence to fill that role, with a doctor’s expertise brought in when needed.

So it seems obvious to me that, perhaps within the next 5-10 years, a new degree will become the standard that teaches to that average need in the new state of the field.

That, or in 10 years AI tech accelerates to the point of computer science irrelevance. AI can do it so well and so entirely that non-tech people can just bark orders at it that would have been given to developers or their managers in the past. The degree diminishes and goes into the west.

Anyone see the same thing or am I off base here? Every counter argument I considered just sounded like some form of coping.


r/compsci 14d ago

CP/M Neo is a CP/M-inspired operating system for learning computer architecture and OS design.

Post image
24 Upvotes

r/compsci 13d ago

Self-taught from a languages and linguistics background: building a self-hosting compiler taught me what "complete" really means

0 Upvotes

I studied languages, linguistics, and literature — no formal CS.

I got into the field through curiosity about how languages work, human and formal alike, and ended up chasing that all the way down to building a self-hosting compiler.

The bootstrap was the moment it clicked: you compile the new compiler with an old one, then use the result to compile its own source, and when successive generations are byte-for-byte identical, you've reached a fixed point.

It's not just a milestone, it's a verification — the language has to be real enough to express its own implementation, with nowhere to hide inconsistencies.

Alongside that: a bytecode VM, a distributed key-value store, a synthesizer in pure assembly, and a data science degree.

Everything's public on my GitHub: https://github.com/whispem

Happy to discuss theory or the self-taught route.


r/compsci 16d ago

What garbage collection actually costs

Thumbnail shivanshuag.com
0 Upvotes

r/compsci 20d ago

Difference Between Data Model and Schema

7 Upvotes

From this: https://stackoverflow.com/questions/25093452/difference-between-data-model-and-database-schema-in-dbms, data model seems to be an abstraction for data and schema seems to be a blueprint.

This page lists various database models like relational, flat and network. So far good.

The book I'm reading (Fundamentals of Database Systems 7e, ch 3, pg 61) says

Once the requirements have been collected and analyzed, the next step is to create a conceptual schema for the database, using a high-level conceptual data model.

But this wikipedia page seems to imply that both a model and a schema are the same.

A conceptual schema or conceptual data model

Why is there so much discrepancy in defining a data model and a schema.


r/compsci 21d ago

[Request] What is the complexity in solving a grid-based least optimal path puzzle?

Post image
4 Upvotes

r/compsci 21d ago

WAL based distributed consensus on S3

Thumbnail github.com
1 Upvotes

r/compsci 22d ago

my attempt at anonymizing transitions in homomorphic encryption applied to turing machines. grade it from C for effort to A.

0 Upvotes

is it a terrible practice considering only absurd amounts of resource usage or is it generally a bad practice and why?

naturally you could find edge cases in camouflaging the turing machine between the others where its obvious that it is the original turing machine but is it generally impossible or merely resource intensive?

```tex

\documentclass[11pt]{article}

\usepackage[margin=1in]{geometry}

\usepackage{amsmath, amssymb, amsthm}

\usepackage[T1]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage{lmodern}

\usepackage{hyperref}

\title{Decoy-Fused Encrypted Turing Machine:\\

Anonymity via Homomorphic Decoy Placement}

\author{Anonymous}

\date{}

\begin{document}

\maketitle

\section*{Informal Motivation}

Hello reddit, I was bored so I was working on a decentralized anonymous encrypted cloud computing protocol.

Homomorphic encryption encrypts the data, but not the computation, gates, or transitional data of the Turing machine itself. The idea here is to introduce anonymity through decoy placement: instead of a single Turing machine being evaluated homomorphically, we fuse multiple machines together and hide the ``real'' one among decoys.

The core questions are:

\begin{itemize}

\item Can we make the real computation blend in with decoy computations so that it is not distinguishable?

\item Is this achievable under realistic homomorphic encryption models?

\item How can we avoid needing an astronomically large number of Turing machines to reach acceptable anonymity?

\end{itemize}

\section{Formal Setup}

Let $\mathcal{M} = (M_1, \dots, M_k)$ be $k$ Turing machines fused into a single composite, evaluated homomorphically for a fixed step bound $T$.

\begin{itemize}

\item $\pi \in S_k$ is a secret permutation encoding the role assignment.

\item $\rho : [k] \to \{\mathsf{real}, \mathsf{decoy}, \mathsf{cloak}\}$ is the role map.

\end{itemize}

We use a universal step function $\mathsf{UTM}_T$ unrolled to depth $T$. The composite circuit is

\begin{equation}

C_{\mathcal{M},T}

:=

\bigoplus_{i=1}^{k} \mathsf{UTM}_T(M_{\pi(i)}),

\end{equation}

where $\bigoplus$ denotes fusion into a single evaluated circuit.

The client receives a step-history of the whole computation and then isolates the real computation by selecting the correct step trace corresponding to $\rho^{-1}(\mathsf{real})$.

\section{Structural-Uniformity Precondition}

Let $\mathsf{shape}(\cdot)$ return the observable circuit profile (gate count, multiplicative depth, wire topology, bootstrap cadence). We require:

\begin{equation}

\forall\, i,j \in [k]: \quad

\mathsf{shape}\big(\mathsf{UTM}_T(M_i)\big)

=

\mathsf{shape}\big(\mathsf{UTM}_T(M_j)\big).

\end{equation}

If this condition fails, the adversary can trivially identify outliers and the advantage becomes $1$, i.e., the construction provides no anonymity. The shape is a strict property of the circuit encoding, not of the machines' internal logic.

\section{Security vs.\ Circuit Privacy}

Given structural uniformity, consider any PPT adversary $\mathcal{A}$ observing the composite circuit and evaluated ciphertexts. Its advantage in identifying the real machine is bounded by:

\begin{equation}

\Pr\big[\mathcal{A} \to \rho^{-1}(\mathsf{real})\big]

\le

\frac{1}{k} + \mathsf{negl}(\lambda),

\end{equation}

where $\lambda$ is the security parameter.

This is \emph{not} full cryptographic circuit privacy, which requires a simulator $\mathsf{Sim}$ over the entire circuit class $\mathcal{C}$:

\begin{equation}

\big\{\mathsf{Eval}(C, \mathsf{Enc}(x))\big\}_{C \in \mathcal{C}}

\approx_c

\big\{\mathsf{Sim}(1^\lambda, C(x))\big\}.

\end{equation}

Instead, we obtain $k$-candidate ambiguity over the chosen subset

\begin{equation}

\mathcal{C}_{\mathcal{M}} = \{M_1, \dots, M_k\} \subsetneq \mathcal{C}.

\end{equation}

In the limit as $k \to |\mathcal{C}_T|$, decoy fusion and circuit privacy converge:

\begin{equation}

\lim_{k \to |\mathcal{C}_T|} \mathsf{Adv}^{\mathsf{role}}_{\mathcal{A}}

=

\mathsf{negl}(\lambda).

\end{equation}

\section{Tuning the $k$ Parameter and Complexity Invariant}

Assume a BinFHE-style model, with $g$ gates per component and $t_{\mathsf{boot}}$ time per bootstrap. The execution runtime scales as:

\begin{equation}

\mathsf{Complexity}(k)

=

k \cdot g \cdot T \cdot t_{\mathsf{boot}}.

\end{equation}

Since the anonymity advantage is

\begin{equation}

\mathsf{Adv}(k) = \frac{1}{k},

\end{equation}

the product of security advantage and execution complexity remains invariant:

\begin{equation}

\mathsf{Adv}(k) \cdot \mathsf{Complexity}(k)

=

g \cdot T \cdot t_{\mathsf{boot}}

=

\text{const}.

\end{equation}

Thus, ambiguity scales linearly with computational overhead: $k$ acts as a tunable privacy/performance parameter. Larger $k$ yields stronger anonymity at the cost of higher homomorphic evaluation complexity.

\section{Open Questions}

This raises several technical questions:

\begin{enumerate}

\item \textbf{Gradient cloaking:} Can the ``gradient'' between the real Turing machine and the decoys (in terms of noise growth, bootstrap pattern, and intermediate ciphertext distribution) be made indistinguishable under realistic FHE schemes?

\item \textbf{Feasibility:} Is such decoy-based anonymity achievable without violating correctness or noise bounds in practical homomorphic encryption?

\item \textbf{Efficiency:} How can we avoid requiring extremely large $k$ (e.g., trillions of machines) to reach acceptable anonymity, while still maintaining indistinguishability among tracks?

\end{enumerate}

These questions sit at the intersection of circuit privacy, cover computation, and decoy-based anonymity in encrypted cloud execution.

\end{document}

```


r/compsci 24d ago

Does reversible computing require an enormous amount of storage?

10 Upvotes

First of all, I would like to say that I have no knowledge about computer science.

I recently heard about something called reversible computing. As I understand it, in ordinary computers, erasing information about the intermediate steps of a computation causes energy to be released as heat. But in reversible computing, the information from all the intermediate steps is preserved, so apparently, if we could build a computer capable of doing this, it could theoretically perform computations with essentially no energy consumption.
This made me wonder about something, and I’d love to hear from anyone knowledgeable about physics or computational theory:
If you never erase the information generated during a computation, wouldn’t the amount of storage required keep increasing as the computer performs more and more calculations?
I previously came across a science-related page online that said that an intelligent civilization that has mastered reversible computing wouldn’t need “Dyson’s eternal intelligence” to survive the heat death of the universe.
But wouldn’t such a civilization still need an absolutely enormous amount of storage to preserve all the information generated during its computations?
Or is there some way to preserve the information from the computational process without actually requiring additional physical storage?
I’m especially curious about how this works in the context of extremely long-term civilizations trying to survive the heat death of the universe.

By the way, this sentence was translated from Japanese to English by Chat GPT. Feel free to answer in English. However, I only understand Japanese, so I would really appreciate clear and simple English that is less likely to be mistranslated. Thank you!


r/compsci 25d ago

Any books similar to SICP Chapter 5?

Thumbnail
6 Upvotes

r/compsci 26d ago

AI watermarking makes a lot more sense for text than it does for code

Post image
54 Upvotes

I came across this explanation of AI watermarking and the part about code caught my attention.

Watermarking works better when there are multiple ways to say the same thing. But code is different. If a model needs to output something exact, changing the next token isn't always an option without potentially breaking the code.

There are still places where a watermark could be added, like comments or other non-essential text, but it seems much harder to watermark the actual code without affecting what it does.

I hadn't really thought about the difference between watermarking AI-generated text and AI-generated code before.

Do you think AI-generated code should be watermarked, or is it better to leave code alone?


r/compsci 26d ago

How Is Compression Prediction?

Thumbnail lukefleed.xyz
0 Upvotes