WHAT THE HELL!? WHERE DID RYAN GO!?
I'm sorry, it's been a LONG while since I've posted here. I'd say I've been busy, but that's only half the story. The other half is lazy. I probably COULD have made a post, but I haven't worked on many hobby projects anyway, so what would I have posted about? Anyway, I've started a new hobby project that is also favorite distraction: gaming.
But before we get into that, an update on my life.
I have started to work on a simple graphics engine. It was designed as a UI for the Sudoku solver I made, but it was more modular than that. I made this UI tool over a weekend for Sudoku Solver, but I have since used it in 4 homework assignments. It's based on SDL and it's highly portable (tested on Linux and Windows). I will pick it up when I'm done with my internship. I hope to make a UI builder that looks to the programmer like iostream. This will make writing UIs very easy for starting programmers (and make creating prototype UIs as easy as prototype command line apps).
I'm in an internship at Sabre. I've learned a lot here and further developed my skills as a Linux developer. I've also picked up some Java (I'm arguably already better than some of my intern peers that have spent years in Java, but lets just say they where too close to the code to see the problem and move on). Virtually my entire time here at Sabre has been parsing and graphing data coming from a major server cluster within Sabre. I've found this project extremely interesting and rewarding on a learning experience level and now that I've got most of it figured out, I would like to commit some of my fixes back to the open source tools I've used (baring that, I'll remake those fixes at home on my own time, don't know the legal implications of ether idea). I've enjoyed the project so much that I'm creating parsers for Minecraft logs put on MineTexas (formally Minecraft, TX) that will let us understand our users better.
And now the big thing. Linux Gaming. I made a commitment in recant past that I would shift my default boot OS on my main tower to Linux when Dota2 (my biggest excuse for not updating this blog) is ported over. That happened; now I plan to follow up on my commitment. I'm thinking about starting a blog as "cheap gamer" or "freeware gamer". I think I'll go into detail on what this means in a separate blog post since many people interested in details might not want to read all of that stuff above.
Tuesday, August 6, 2013
Thursday, December 27, 2012
to do list
I've written a bit of hobby code this semester, but I haven't posted any of it. I'm posting this to make me go do it. I also plan on setting up a git server started, so I don't have to use other file servers.
If you know me, remind mute to get that code up here.
Tuesday, September 11, 2012
School is starting
School is starting now and my summer is over. I'm very disappointed in myself that I didn't get more coding done, however, I've learned a bit about SDL and my Sudoku solver blows my dad's out of the water (it can even solve some puzzles that his cannot).
This semester, I'm taking Game Programming 1 and Game Physics. For both of those classes, I might be writing relevant code, so I might post some assignments I found interesting.
I would like to write a UI for my Sudoku solver, but we'll see. I'm trying to spend my spare time working relevant stuff like this (instead of just using my laptop for gaming), however I've got a lot of homework too, so we'll see about that too.
This semester, I'm taking Game Programming 1 and Game Physics. For both of those classes, I might be writing relevant code, so I might post some assignments I found interesting.
I would like to write a UI for my Sudoku solver, but we'll see. I'm trying to spend my spare time working relevant stuff like this (instead of just using my laptop for gaming), however I've got a lot of homework too, so we'll see about that too.
Saturday, August 18, 2012
I was bored because I couldn't figure out this thing...
Building a (week) game engine using SDL, will probably convert it to OpenGL eventually, but until then, THIS:
Now, I like to think of my self as pretty fluent in C++ syntax, but for the life of me I can't figure out what the heck I'm doing wrong. This isn't the code I'm actually working, but it has the same syntax problem as what I'm actually doing. I have a class that acts one way, then another one the is almost exactly the same, but it has a compleatly differnt constructor and a few extra functions attached to it. So, I was going just inharit off of it overloading the constructor, but it doesn't seem to be working... clearly I'm doing something wrong...
#include <iostream>
class Number
{
private:
float x;
public:
Number( float input)
{
x = input;
}
}
class OtherNumber : public Number
{
private:
public:
OtherNumber( float input )
{
x = 0;
x -= input;
}
}
int main()
{
}
Now, I like to think of my self as pretty fluent in C++ syntax, but for the life of me I can't figure out what the heck I'm doing wrong. This isn't the code I'm actually working, but it has the same syntax problem as what I'm actually doing. I have a class that acts one way, then another one the is almost exactly the same, but it has a compleatly differnt constructor and a few extra functions attached to it. So, I was going just inharit off of it overloading the constructor, but it doesn't seem to be working... clearly I'm doing something wrong...
Saturday, July 21, 2012
I was bored, so I wrote a Sudoku Solver
My Dad wrote a Sudoku solver that works in Excel . It's slow. I was discussing with him how he built it and I starting thinking how I would build one.
So I did. And it's messy. But it works!
It's messy, it's not a release, and the comments suck... but it works! (now, someone give me a puzzle that breaks it!
ToDo:
1: Better Input System
2: Better Debug Logging
3: Suggestions?
http://www.mediafire.com/?mg9elrhbwkb63om
So I did. And it's messy. But it works!
It's messy, it's not a release, and the comments suck... but it works! (now, someone give me a puzzle that breaks it!
ToDo:
1: Better Input System
2: Better Debug Logging
3: Suggestions?
http://www.mediafire.com/?mg9elrhbwkb63om
1: #include <iostream>
2: #include "math.h"
3: #include <string>
4: using namespace std;
5: bool Debug = 0;
6: char abs(char x) //GCC is missing a char abs(char) function... wrote this as an after thought.
7: {
8: if( x < 0)
9: {
10: return (0-x);
11: }
12: else return x;
13: }
14: class puzzle
15: {
16: char PuzzleValues[9][9];
17: unsigned short sets[3][9];
18: public:
19: int updateSets() //returns number of changes. return system could be faster if integrated into
20: {
21: puzzle temp = *this;
22: //horizontal sets
23: for(int y = 0; y < 9 ; y++)
24: {
25: sets[0][y] = 0;
26: for(int x = 0; x < 9 ; x++)
27: {
28: if( GetValue(y,x) != 0 )
29: {
30: sets[0][y] += ((1 << (abs(GetValue(y,x))-1)) );
31: }
32: }
33: }
34: //vertical sets
35: for(int x = 0; x < 9 ; x++)
36: {
37: sets[1][x] = 0;
38: for(int y = 0; y < 9 ; y++)
39: {
40: if( GetValue(y,x) != 0 )
41: {
42: sets[1][x] += ( (1 << (abs(GetValue(y,x))-1)) );
43: }
44: }
45: }
46: //box sets
47: for(int group = 0; group < 9 ; group++)
48: {
49: sets[2][group] = 0;
50: for(int cell = 0; cell < 9; cell++)
51: {
52: int x = (3*(group%3)+cell%3);
53: int y = (3*(group/3)+cell/3);
54: if( GetValue(y,x) != 0 )
55: {
56: sets[2][group] += ( (1 << (abs(GetValue(y,x))-1)) );
57: }
58: }
59: }
60: int changes = 0;
61: for(int loop = 0; loop < 27 ; loop++ )
62: {
63: if( sets[loop/9][loop%9] != temp.sets[loop/9][loop%9] )
64: {
65: changes++;
66: }
67: }
68: return changes;
69: }
70: /*Objects of pointers are set to CELL Sets and Ranks, returns 0 for success, 1 or 3 for failed Set Pointer, 2 or 3 for failed RankPointer*/
71: short cellSet( int y , int x , short* Rank )
72: {
73: if( !PuzzleValues[y][x] )
74: {
75: short Set = 0;
76: short Temp;
77: Temp = ( (short)
78: 0x1ff - //4: then take 1 1111 1111 and subtract the row ORs from that
79: (
80: sets[0][y] | //1: check first row
81: sets[1][x] | //2: OR that with 2nd row
82: sets[2][(x/3)+(y - (y % 3 ))] //3: OR that with 3rd row to for the list of numbers that are close to a number
83: )
84: );
85: Set = Temp;
86: if(Rank != NULL )
87: {
88: short count = 0 ;
89: while (Temp) //count the number of 1s in Temp
90: {
91: count++;
92: Temp &= (Temp - 1) ;
93: }
94: *Rank = count;
95: }
96: return Set;
97: }
98: else
99: {
100: if(Rank != NULL)
101: {
102: *Rank = 0;
103: }
104: return 0;
105: }
106: }
107: //returns value at point, negitive for orignal puzzle
108: char GetValue( int y, int x )
109: {
110: return PuzzleValues[y][x];
111: }
112: //pass negitive VALUE for orignal puzzle
113: int SetValue( int y, int x, char VALUE /*-9 to 9*/ )
114: {
115: if( -9 <= VALUE && VALUE <= 9 )
116: {
117: PuzzleValues[y][x] = VALUE;
118: return 1;
119: }
120: else return 0;
121: }
122: //display the table. build a better table with ascii lines
123: string Display()
124: {
125: string OUTPUT;
126: for( int y = 0 ; y < 9 ; y++)
127: {
128: if( !(y%3))
129: {
130: OUTPUT += "+---------+---------+---------+\n";
131: }
132: for( int x = 0 ; x < 9 ; x++)
133: {
134: if( !(x%3) )
135: {
136: OUTPUT += "|";
137: }
138: if( 1 <= GetValue(y,x) && GetValue(y,x) <= 9 )
139: {
140: OUTPUT += ' ';
141: OUTPUT += (GetValue(y,x) + 48);
142: OUTPUT += ' ';
143: }
144: else if( -9 <= GetValue(y,x) && GetValue(y,x) <= -1 )
145: {
146: OUTPUT += '{';
147: OUTPUT += (( 0 - GetValue(y,x) ) + 48 );
148: OUTPUT += '}';
149: }
150: else
151: {
152: OUTPUT += " ";
153: }
154: }
155: OUTPUT += "|\n";
156: }
157: OUTPUT += "+---------+---------+---------+\n";
158: return OUTPUT;
159: }
160: //fills cells currently at rank1 that aren't full. returns number of changes
161: int fillCells()
162: {
163: int changes = 0;
164: //int CellInfluance[9][9];
165: for ( int x = 0; x < 9 ; x++ )
166: {
167: for ( int y = 0; y < 9 ; y++ )
168: {
169: //////should be replaced with the new fuction that does this for you.
170: //finds the binary list of 1 to 9 that are there.
171: int q = 0x1ff - ( //4: then take 1 1111 1111 and subtract the row ORs from that
172: sets[0][y] | //1: check first row
173: sets[1][x] | //2: OR that with 2nd row
174: sets[2][(x/3)+(y - (y % 3 ))] //3: OR that with 3rd row to for the list of numbers that are close to a number
175: );
176: //if power of 2, then return
177: for ( int p = 0 ; p < 9 ; p++ )
178: {
179: //reworked with previusly mentioned relacement
180: if(q == (1 << p) && GetValue( y , x ) == 0)
181: {
182: SetValue( y , x , (p+1) );
183: changes++;
184: }
185: }
186: }
187: }
188: return changes;
189: }
190: int Solved()
191: {
192: for(int x = 0 ; x < 81 ; x++)
193: {
194: if( !GetValue( x/9 , x%9 ) )
195: return 0;
196: }
197: return 1;
198: }
199: int unSolveable() //returns 0 if puzzle is unsolveable, 1 if it might be solveable
200: {
201: for(int x = 0 ; x < 81 ; x++)
202: {
203: if( !GetValue( x/9 , x%9 ) && !cellSet( x/9 , x%9 , NULL ) )
204: {
205: return 1;
206: }
207: }
208: return 0;
209: }
210: };
211: int Solve(puzzle *inPuzzle)
212: {
213: puzzle WCopy = *inPuzzle;
214: do
215: {
216: if( Debug == 1){
217: cout << WCopy.Display();
218: }
219: WCopy.updateSets();
220: } while( WCopy.fillCells() );
221: if( Debug == 1){
222: cout << WCopy.Display();
223: }
224: if( !WCopy.Solved() )
225: {
226: if( !WCopy.unSolveable() )
227: {
228: if( Debug == 1){
229: cout << WCopy.Display();
230: }
231: short LowestRank = 10;
232: short LowestSet;
233: char LowestRankX;
234: char LowestRankY;
235: //for loop that finds first lowest rank
236: for(char y = 0 ; y < 9 ; y++ )
237: {
238: for (char x = 0; x < 9 ; x++ )
239: {
240: short RANK = 0;
241: short SET = WCopy.cellSet( y , x , &RANK );
242: if( RANK != 0 && RANK < LowestRank && !WCopy.GetValue(y, x))
243: {
244: LowestRank = RANK;
245: LowestSet = SET;
246: LowestRankX = x;
247: LowestRankY = y;
248: }
249: }
250: }
251: //loop that guesses values out of that xy rank
252: for( short Guess = 0 ; Guess < 9 ; Guess++ )
253: {
254: if( (1 << Guess) & LowestSet )
255: {
256: puzzle GuessCopy = WCopy; //make a copy
257: GuessCopy.SetValue( LowestRankY , LowestRankX , Guess + 1 ); //dump guess into the copy
258: if( Debug == 1){
259: cout << WCopy.Display();
260: }
261: if( Solve( &GuessCopy ) )
262: {
263: if( Debug == 1){
264: cout << WCopy.Display();
265: }
266: *inPuzzle = WCopy = GuessCopy;
267: return 1;
268: }
269: }
270: }
271: return 0;
272: //if one guess wins, "*inPuzzle = WCopy;" and return 1
273: //if a guess fails, try next
274: //if all guesses fail, return 0;
275: }
276: else
277: return 0;
278: }
279: else
280: {
281: if( inPuzzle != NULL )
282: *inPuzzle = WCopy;
283: return 1;
284: }
285: }
286: int main(int argc, char *argv[])
287: {
288: string Input;
289: if(argc <= 1)
290: {
291: cout << "ERROR!, you're doing it wrong... Imma put more detal here later... \n" <<
292: "OR I could just solve a puzzle for you! How's that sound!?\n" <<
293: "how about this hard one! =D\n";
294: Input = "86..2.......7...59.............6.8...4.........53....7..........2....6....75.9..."; //hard puzzle
295: Debug = 0;
296: }
297: if(argc > 1)
298: {
299: Input = argv[1];
300: }
301: if(argc > 2)
302: {
303: // char test =
304: Debug = ( *argv[2] - '0');
305: }
306: //system("mode con cols=82");
307: puzzle MainPuzzle;
308: // Input = "86..2.......7...59.............6.8...4.........53....7..........2....6....75.9..."; //hard puzzle
309: // Input = ".931.564.7.......55.12.93.72.......3.369.752.9.......13.24.81.96.......4.473.285."; //easy puzzle
310: // Input = ".3..........28.1.7.78.6.4.....8.2.7..82...54..9.5.4.....1.7.25.8.6.21..........8."; //mid puzzle
311: cout << "starting input:\n" << Input << "\nstarting puzzle:\n";
312: for(int y = 0; y < 9 ; y++ )
313: {
314: for(int x = 0; x < 9 ; x++ )
315: {
316: cout << Input[y*9 + x];
317: char q = Input[ 9 * y + x ];
318: if( q != '.' )
319: {
320: MainPuzzle.SetValue( y , x , 0 - (q - 48) );
321: }
322: else
323: {
324: MainPuzzle.SetValue( y , x , 0 );
325: }
326: }
327: cout << '\n';
328: }
329: cout << MainPuzzle.Display();
330: Solve( &MainPuzzle );
331: cout << "\n\nDERP!\n\n";
332: cout << MainPuzzle.Display();
333: //MainPuzzle.updateSets();
334: //short CellSets[2][9][9];
335: //bool run = true;
336: //while( run )
337: //{
338: // MainPuzzle.updateSets();
339: // while(MainPuzzle.fillCells() )
340: // {
341: // MainPuzzle.updateSets();
342: // cout << '\n' << MainPuzzle.Display();
343: // }
344: // for( int x = 0; x < 81 ; x++)
345: // {
346: // short q; //rack
347: // short p; //sets
348: // p = MainPuzzle.cellSet( x%9 , x/9 , &q );
349: // CellSets[0][x/9][x%9] = q;
350: // CellSets[1][x/9][x%9] = p;
351: // }
352: // run = true;
353: //
354: //}
355: // system( "pause" ); //works only Visual Studio compiler.
356: }
Tuesday, June 19, 2012
I wasn't bored so I haven't been blogging
This blog is still a thing, and I still want to produce content for it, but I haven't been blogging lately because I've been busy (and my code is dumb).
Right now I'm taking 8 credit hours over 4 weeks. These classes are Linear Algebra and Physics. The things I'm learning in these classes make my code look really stupid. The code I've writen was created for simple 2d side scroller simulation, but I was solving collision equations using Geometry. Made sense to a guy with a High School level education, but now I'm learning things that makes that look really dumb because you can do the same thing with half as many calculations.
For example, the last thing I was working on was a way to detect if a point was left or right of a line. I was going to use a look a geometry based collision algorithm combines with a look up table, but now I know that if you have a line that is AB and you want to see if point C is left of that line, then you could just use this code:
Then the sign of Q is related to the leftness or rightness of the point to the line (can't remember which, and 0 is on the line). A lot of my code could be simplified using things I've learned in Linear Algebra and I was in the process of rewriting the whole thing anyway (I knew it was flawed and overly complicated, but I couldn't figure out how).
Anyway, I miss blogging and writing code for fun, but I'm really busy learning why the code I've already written is dumb and inefficient. Once I finish, I'll start up again!
Right now I'm taking 8 credit hours over 4 weeks. These classes are Linear Algebra and Physics. The things I'm learning in these classes make my code look really stupid. The code I've writen was created for simple 2d side scroller simulation, but I was solving collision equations using Geometry. Made sense to a guy with a High School level education, but now I'm learning things that makes that look really dumb because you can do the same thing with half as many calculations.
For example, the last thing I was working on was a way to detect if a point was left or right of a line. I was going to use a look a geometry based collision algorithm combines with a look up table, but now I know that if you have a line that is AB and you want to see if point C is left of that line, then you could just use this code:
int Q = (Bx-Ax)(Cy-Ay) - (By-Ay)(Cx-Cy)
Then the sign of Q is related to the leftness or rightness of the point to the line (can't remember which, and 0 is on the line). A lot of my code could be simplified using things I've learned in Linear Algebra and I was in the process of rewriting the whole thing anyway (I knew it was flawed and overly complicated, but I couldn't figure out how).
Anyway, I miss blogging and writing code for fun, but I'm really busy learning why the code I've already written is dumb and inefficient. Once I finish, I'll start up again!
Thursday, May 3, 2012
Steam for Linux means Linux for Steam
Steam on Linux. That's a thing. It's coming. They have a naively running L4D2 working on Ubuntu using AMD's Linux drivers.
Steam on Linux has been "coming" for a long time. They've had job postings for Linux OpenGL developers for years. The reason why it's actually news now is because a member of the press was aloud to see Steam on Linux.
Valve is also working on a version of Steam designed to be used on a TV. That means UI designed for a lower resolution and to be controlled with something like a console controller (XBox controller is a Windows USB device). They are going to great efforts to clone an console-like experience.
What we need is a distro of Linux Designed for Steam. Why? Because for most people, Linux is entirely to much effort.
Ubuntu answers most of those problems for day to day computer use. If all you do is web applications and simple Office-style work, Ubuntu is a great Linux distro.
We need Ubuntu for gaming. We need a Linux distro that uses minimal background CPU and Memory, give games as much of the graphics card as possible, include Linux drivers for gaming level graphics cards, and as little else as possible. No OpenOffice, no ThunderBird, no IDE. Just a web browser, Steam, and an Ubuntu-like app-store to let people add what they'll use. It needs a UI designed for both Keyboard/Mouse and TV/Gamepad.
Valve could build this Linux distribution, and could even help push Nvidia and ATI to better their driver support, but more likely it would have to come out of the Linux comunity and, with Steam support, I can see the Linux community getting behind gaming in a big way if a company as influential as Valve pushed full native support for Linux.
If we had Gamebuntu... SteamBuntu, yeah, lets go with that. If we had SteamBuntu, then HP, Dell, Toshiba, Acer, Asus, or anyone else could build computers like we saw for early HP/Dell netbooks with Ubuntu. We could see Alienware style gaming grade machines that ship with SteamBuntu instead of Windows. We might even see smaller formfactor systems designed like a modern game console that fit next to your TV. These systems would ship working with Steam and all the drivers they need.
Valve has said that they are not planning on going into the hardware market any time soon, but they don't have to for there to be a ValveBox.
I not only think this is what should happen, but I think it will happen. Assuming Valve gets Steam on Linux by the end of the year (I know, maybe a bit too hopeful), I think we could see more game studios publish for Linux (we're already seeing that with many indie studios). Within a year or two we will probably see a version of Linux pre-configured with Steam. Assuming Linux For Steam becomes a popular alternative to Windows, we will start to see Dell or HP making gaming grade systems that ship with SteamBuntu (Microsoft will probably pay them to not do this for as long as possible, but that can't last if their is a large enough demand).
Steam on Linux has been "coming" for a long time. They've had job postings for Linux OpenGL developers for years. The reason why it's actually news now is because a member of the press was aloud to see Steam on Linux.
Valve is also working on a version of Steam designed to be used on a TV. That means UI designed for a lower resolution and to be controlled with something like a console controller (XBox controller is a Windows USB device). They are going to great efforts to clone an console-like experience.
What we need is a distro of Linux Designed for Steam. Why? Because for most people, Linux is entirely to much effort.
Ubuntu answers most of those problems for day to day computer use. If all you do is web applications and simple Office-style work, Ubuntu is a great Linux distro.
We need Ubuntu for gaming. We need a Linux distro that uses minimal background CPU and Memory, give games as much of the graphics card as possible, include Linux drivers for gaming level graphics cards, and as little else as possible. No OpenOffice, no ThunderBird, no IDE. Just a web browser, Steam, and an Ubuntu-like app-store to let people add what they'll use. It needs a UI designed for both Keyboard/Mouse and TV/Gamepad.
Valve could build this Linux distribution, and could even help push Nvidia and ATI to better their driver support, but more likely it would have to come out of the Linux comunity and, with Steam support, I can see the Linux community getting behind gaming in a big way if a company as influential as Valve pushed full native support for Linux.
If we had Gamebuntu... SteamBuntu, yeah, lets go with that. If we had SteamBuntu, then HP, Dell, Toshiba, Acer, Asus, or anyone else could build computers like we saw for early HP/Dell netbooks with Ubuntu. We could see Alienware style gaming grade machines that ship with SteamBuntu instead of Windows. We might even see smaller formfactor systems designed like a modern game console that fit next to your TV. These systems would ship working with Steam and all the drivers they need.
Valve has said that they are not planning on going into the hardware market any time soon, but they don't have to for there to be a ValveBox.
I not only think this is what should happen, but I think it will happen. Assuming Valve gets Steam on Linux by the end of the year (I know, maybe a bit too hopeful), I think we could see more game studios publish for Linux (we're already seeing that with many indie studios). Within a year or two we will probably see a version of Linux pre-configured with Steam. Assuming Linux For Steam becomes a popular alternative to Windows, we will start to see Dell or HP making gaming grade systems that ship with SteamBuntu (Microsoft will probably pay them to not do this for as long as possible, but that can't last if their is a large enough demand).
Subscribe to:
Posts (Atom)