carlini / printf-tac-toe Goto Github PK
View Code? Open in Web Editor NEWtic-tac-toe in a single call to printf
License: GNU General Public License v3.0
tic-tac-toe in a single call to printf
License: GNU General Public License v3.0
You printf() program is not Turing complete as it require an external while() loop to work. It would be turing complete if this control structure was embedded inside the printf() arguments.
Posting on behalf of a friend:
There is a bug in the tic-tac-toe game. P1 wins if either player plays their piece on an occupied square.
Gotta use that GItHub "blame" button
The link should be to https://www.ioccc.org
Currently, it's to http://ioccc.org/ which doesn't resolve
this is super interesting!!
although i don't completely understand how this works, i just found a bug โ if your opponent places their letter on position already taken by you they just win automatically.
[deleted]
Before reading my issue, please know that I'm very impressed with this, and I got a lot out of reading the README - thank you / really well done!
I'm using PuTTY v0.73 to access an Ubuntu 18.04 machine, compiled as per the README.
Step 1: Run, empty board is presented:
Step 2: Enter 5 and press Return:
Step 3: Enter 1 and press Return:
It turns out that the string PuTTY
is sent to stdin
... I've never quite figured out what causes these to occur, and I've seen them in the past too - mainly when accidentally writing binary data to stdout
.
If I remove the PuTTY
input with 5x Backspace then I can play the game... if I'm lucky...
However, I also notice that playing the following game, results in some "invisible" characters in the input buffer, allowing me to press backspace, and get the cursor to wrap back on to the previous line:
5
, 1
, 7
, 3
If I do clear this "invisible" input, then the following game runs to completion:
5
, 1
, 7
, 3
, 2
, 8
, 4
, 6
, 9
If I don't clear this "invisible" intput (i.e: I only press 5x Backspace to remove the PuTTY
, or multiple thereof), then the game goes wonky... it may run to the end, or it may make wrong statements.
I suspect that this "invisible" input is also related to PuTTY, hence putting all of this in a single issue.
You wrote
Computing the NOT of a single value is also easy:
printf("%1$255d%1$s%hhn", a, b)
will compute
*b = (strlen(a)+255)%256 = strlen(a)-1
and again, because strlen(x) is either 1 or 0 we have
*c = !b
Well,in *c=!b
,where does c come from? Do you mean *b=!a
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.