Skip to content

Instantly share code, notes, and snippets.

@arikrak
Last active December 10, 2015 09:39
Show Gist options
  • Save arikrak/4415695 to your computer and use it in GitHub Desktop.
Save arikrak/4415695 to your computer and use it in GitHub Desktop.
//Constantin’s shortened solution to Sudoku CodeGolf
#include<iostream>
#define O std::cout<<
#define F(i) for(int i=-1;++i<9;)
#define H G[i][j]
#define R return 0
#define Y ]==d+1
#define P F(i){F(j)
int G[9][9];
int s(){
P
if(H==0){
F(d){
F(q)
if(G[i][q
Y|G[q][j
Y|G[i/3*3+q/3][j/3*3+q%3
Y)
goto D;
H=d+1;
if(s())
R+1;
D:; }
H=0; R; }}
R+1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment