Maurice Harris

Member
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

126 Neutral

About Maurice Harris

  • Rank
    Newbie
  1. Why doesn't Nintendo make a tablet?

    I agree that the software is a problem that they've had this generation as well. I think they should have waited until they were sure they could have their flagship games like Zelda, Mario, and Pikmin out when the Wii U launched, of course I am saying this in hindsight and looking at the launches of the PS4 and Xbox One they seemed to do okay despite the software so maybe I'm wrong.   Regardless of whether or not the software had as huge an affect on Wii U sales as we might think I believe having a Nintendo tablet with an app store like Apple's except ran a bit more conservatively could have them getting tons of indie and big time mobile developers to develop for their tablet if they provide a proper infrastructure for developers. Unfortunately for Nintendo opening up their console to this extent would increase competition.
  2. Why doesn't Nintendo make a tablet?

    Watching Nintendo stumble out of the gate with the launch of their Wii U console I've been thinking about Nintendo's future as a console maker. I've read plenty of reports about how Nintendo isn't getting the numbers they hoped for with the Wii U and its games while the 3DS is still selling pretty well. I think a Nintendo has the potential to sell pretty well if it's marketed as a handheld gaming device that also functions as any mainstream tablet does. They could make it so the tablet could be hooked up or streamed to the TV like the Wii U tablet without the Wii U console, then when you want to move while playing just take it and go.   A sensor for the Wii motion controllers could be built into it so if you did play on the TV and used to own a Wii you wouldn't need to buy new controllers. They could also start making their traditionally handheld games for this handheld/home console hybrid and hopefully they could get all kinds of developers to trying to get their mobile only games onto their system. The new Ipad Air costs about $450 without tax, this new tablet could cost as much as a Wii U (about $300?) and compete against these types of tablets. If Nintendo were able to make this tablet look sleek and cool enough to get adults into it Nintendo could have the adults buying the tablets for themselves and for their children. So why doesn't Nintendo make a tablet?   I'm sorry if this seemed like rambling but this idea has been itching my brain for like a year now. Also, I'll be the first to admit to that I don't know everything about the console and mobile industry and I may be wrong, but I believe this would be a golden opportunity for Nintendo.
  3. Should I Redesign and Start Over?

    I must confess, I had performed a cardinal sin of programming. I did not comment my code (save a line here or there).   So all yesterday I went through my project again and began to add in comments where I thought it necessary. Going through and adding comments made me realize the importance of this since I was coming back to this after about 2-3 weeks hiatus and was a bit overwhelmed by I had previously made. However, after spending some time adding comments I feel as though maybe this is still salvageable, and so I think I'll spend some re-factoring my code so there are less dependencies as recommended. Dependencies was a big problem for me, everything seems to go into a circle of dependency. Thank you all for replying with helpful advice.
  4. Should I Redesign and Start Over?

    So I have been working on a platformer game on and off for about 2 months now and I have come to a point where every sort of feels like a convoluted mess. Everything works alright and I have things up on the screen, however every time I get to work on my project I feel like the architecture of the whole thing is fundamentally wrong and I keep digging a deeper whole every time I add something. I just wanted the opinions of the professionals here before I did anything drastic.
  5. Completed Tic Tac Toe - Critical Critiques and Advice

    I figured out how to generalize my win checking like you said Trienco. Lately I've been trying to make it work so if for example I had a 9x6 board it would check for n in a row every time someone made a move, however I find that I end up repeating myself, my code becomes bloated, and I haven't figured out how to check for diagonal wins where x != y. I've changed the board from a 1D char array to a 2D int array so I could better visualize logic: [source lang="csharp"]using System; namespace TicTacToeTests { class Program { const int BOARD_WIDTH = 9; const int BOARD_HEIGHT = 6; static int turnCount = 0; // Is going to be used to determine when the game is at a tie static int[,] board = new int[BOARD_WIDTH, BOARD_HEIGHT]; static void Move(int x, int y, int player) { // Number of spots in a row to win int n = 4; // Check to see if the spot is empty if(board[x,y] == 0) { board[x,y] = player; } turnCount++; int i = 0; int xMatch = 0; // Check Column while (i < (BOARD_WIDTH)) { if (board[i, y] != player) { xMatch = 0; } else { xMatch++; if (xMatch >= n) { Console.WriteLine("\nPlayer " + player + " wins!"); break; } } i++; } int j = 0; int yMatch = 0; // Check Row while (j < (BOARD_HEIGHT)) { if (board[x, j] != player) { yMatch = 0; } else { yMatch++; if (yMatch >= n) { Console.WriteLine("\nPlayer " + player + " wins!"); break; } } j++; } } static void Main(string[] args) { board[2, 4] = 1; board[2, 3] = 1; Move(2, 2, 1); Move(2, 5, 1); } } } [/source]
  6. Completed Tic Tac Toe - Critical Critiques and Advice

    Great, I'll go back to reading for now. Thank you all for giving me advice and help, I hope to share better projects in the future.
  7. Completed Tic Tac Toe - Critical Critiques and Advice

    I made the suggestions you gave to me and my program feels and looks less bloated. I feel once I get further along in reading [i]The C# Yellow Book[/i] by Robert Miles, I'll be able to improve upon my design little by little until I'm satisfied. I just recently got to the 4th chapter of the book and it's starting to talk about objects and how to represent them so hopefully I'll be able to come back very soon and further improve the design of this and future projects. Trienco, I've been thinking about what you said about having a board that's 4x4, 5x5, or any random 2 values and I'm having trouble thinking about how I could handle this without thinking myself into a corner. Updated Source: [source lang="csharp"]/* * Tic Tac Toe - by Maurice Harris * Last Modified: 11/16/12 */ using System; namespace TicTacToeGame { class TicTacToe { // The Tic Tac Toe board static char[] board = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }; // Used to keep track of whether the current game is over static bool gameOver = false; // Used to keep track of whether a new game has started static bool newGame = true; // Draws a tic tac toe board static void DrawBoard() { Console.WriteLine("\n\n " + board[6] + " | " + board[7] + " | " + board[8]); Console.WriteLine(" ---+---+---"); Console.WriteLine(" " + board[3] + " | " + board[4] + " | " + board[5]); Console.WriteLine(" ---+---+---"); Console.WriteLine(" " + board[0] + " | " + board[1] + " | " + board[2] + "\n\n"); } // Clears a tic tac toe board static void ClearBoard() { // Loop through char array elements and set them equal to ' ' for (int i = 0; i < board.Length; i++) { board[i] = ' '; } } // Checks the board to see if the space is taken up by an O or X static bool IsSpaceFree(int move) { return board[move] == ' '; } // Marks spot on the tic tac toe board with a marker if the space is free static bool MakeMove(char marker, int move) { if (IsSpaceFree(move)) { board[move] = marker; return true; } else { Console.WriteLine("\nThat spot is taken."); return false; } } // Take input from either the numpad or numerical keys 1-9 and mark the board static void TakeInput(char marker) { // Keep track of whether or not the user has pressed a valid key for marking the board bool validKeyPressed = false; // Keep track of the key pressed by the user ConsoleKeyInfo keyPressed; // The spot picked by the user int spot = -1; // While loop to catch valid input from the user while (!validKeyPressed) { keyPressed = Console.ReadKey(true); // If the key pressed is valid and the spot is unmarked, mark it, // Otherwise break the switch statement and take new key input switch (keyPressed.Key) { case ConsoleKey.NumPad1: case ConsoleKey.D1: spot = 0; break; case ConsoleKey.NumPad2: case ConsoleKey.D2: spot = 1; break; case ConsoleKey.NumPad3: case ConsoleKey.D3: spot = 2; break; case ConsoleKey.NumPad4: case ConsoleKey.D4: spot = 3; break; case ConsoleKey.NumPad5: case ConsoleKey.D5: spot = 4; break; case ConsoleKey.NumPad6: case ConsoleKey.D6: spot = 5; break; case ConsoleKey.NumPad7: case ConsoleKey.D7: spot = 6; break; case ConsoleKey.NumPad8: case ConsoleKey.D8: spot = 7; break; case ConsoleKey.NumPad9: case ConsoleKey.D9: spot = 8; break; default: Console.WriteLine("\nPlease use your numpad or the keys 1-9 to choose a spot to mark."); break; } if (spot != -1) { Console.Clear(); validKeyPressed = MakeMove(marker, spot); } } } // Check to see if the board has no unmarked spots left static bool IsBoardFull() { for (int i = 0; i < board.Length; i++) { if (board[i] == ' ') { return false; } } return true; } // Check a set of numbers static bool CheckWinSet(char marker, int a, int b, int c) { return ((board[a] == marker) && (board[b] == marker) && (board[c] == marker)); } // Check to see if someone has won or if there is a tie // Return a string to annouce the game's final state static string CheckWinner(char marker) { while(true) { // Horizontal Win if (gameOver = CheckWinSet(marker, 0, 1, 2)) { break; } if (gameOver = CheckWinSet(marker, 3, 4, 5)) { break; } if (gameOver = CheckWinSet(marker, 6, 7, 8)) { break; } // Vertical Win if (gameOver = CheckWinSet(marker, 0, 3, 6)) { break; } if (gameOver = CheckWinSet(marker, 1, 4, 7)) { break; } if (gameOver = CheckWinSet(marker, 2, 5, 8)) { break; } // Diagonal Win if (gameOver = CheckWinSet(marker, 0, 4, 8)) { break; } if (gameOver = CheckWinSet(marker, 2, 4, 6)) { break; } break; } if (gameOver) { return marker + " wins!\n"; } // Tie Game if (IsBoardFull()) { gameOver = true; return "No one wins, it's a tie!\n"; } return null; } // Introduce the game to users and explain how to play static void Intro() { Console.WriteLine("\n\n Welcome to Tic Tac Toe!\n\n"); Console.WriteLine(" Currently you can only play against another human player."); Console.WriteLine(" To pick a spot on the Tic Tac Toe board use the keypad or the numbers 1-9."); Console.WriteLine(" You must have num-lock on to be able to use the keypad for input."); Console.WriteLine(" The keypad positions correspond to the Tic Tac Toe board."); // Draws a tic tac toe board with numbers in the spaces to correspond with the numpad Console.WriteLine("\n\n 7 | 8 | 9 "); Console.WriteLine(" ---+---+---"); Console.WriteLine(" 4 | 5 | 6 "); Console.WriteLine(" ---+---+---"); Console.WriteLine(" 1 | 2 | 3\n\n"); Console.WriteLine(" Press any key to start the game!"); Console.ReadKey(true); Console.Clear(); } // The Tic Tac Toe Game's heart static void TicTacToeGame() { char playerTurn = 'O'; string winner = ""; Intro(); DrawBoard(); while (!gameOver) { Console.WriteLine("It is " + playerTurn + "'s turn to move!"); TakeInput(playerTurn); DrawBoard(); winner = CheckWinner(playerTurn); playerTurn = (playerTurn == 'O') ? 'X' : 'O'; } Console.WriteLine(winner); } static void PlayAgain() { Console.WriteLine("Would you like to play again? [Y]es/[N]o?\n"); string response = Console.ReadLine(); switch (response.ToLower()) { case "yes": case "y": gameOver = false; Console.Clear(); ClearBoard(); break; case "no": case "n": newGame = false; Console.Clear(); ClearBoard(); break; default: break; } } static void Main() { // While loop that runs through the intro and a full game of human vs. human tic tac toe // The loop continues until the user responds with a n or no to another game of tic tac toe while (newGame) { TicTacToeGame(); PlayAgain(); } } } } [/source]
  8. Hello, my name is Maurice Harris and recently while learning my first language(C#) I have completed my first game, Tic Tac Toe. I am here before you all asking for critique and advice on my design of the game Tic Tac Toe. Although I am relieved to have finally completed my first game I feel as though it could use serious improvement design-wise and would like helpful advice on how to improve not only my game but also my programming skills so I can become a much better programmer and avoid the headaches I faced making what I thought would be a simple game to create. So without further ado I present my version of the classic Tic Tac Toe. [source lang="csharp"]/* * Tic Tac Toe - by Maurice Harris * Last Modified: 11/15/12 */ using System; namespace TicTacToeGame { class TicTacToe { static bool gameOver = false; // Draws a tic tac toe board static void DrawBoard(char[] board) { Console.WriteLine("\n\n " + board[6] + " | " + board[7] + " | " + board[8]); Console.WriteLine(" ---+---+---"); Console.WriteLine(" " + board[3] + " | " + board[4] + " | " + board[5]); Console.WriteLine(" ---+---+---"); Console.WriteLine(" " + board[0] + " | " + board[1] + " | " + board[2] + "\n\n"); } // Clears a tic tac toe board static void ClearBoard(char[] board) { // Loop through char array elements and set them equal to ' ' for (int i = 0; i < board.Length; i++) { board[i] = ' '; } } // Draws a tic tac toe board with numbers in the spaces to correspond with the numpad static void DrawExampleBoard() { Console.WriteLine("\n\n 7 | 8 | 9 "); Console.WriteLine(" ---+---+---"); Console.WriteLine(" 4 | 5 | 6 "); Console.WriteLine(" ---+---+---"); Console.WriteLine(" 1 | 2 | 3\n\n"); } // Checks the board to see if the space is taken up by an O or X static bool SpaceFree(char[] board, int move) { return board[move] == ' '; } // Marks spot on the tic tac toe board with a marker if the space is free static bool MakeMove(char[] board, char marker, int move) { if (SpaceFree(board, move)) { board[move] = marker; return true; } else { Console.WriteLine("\nThat spot is taken."); return false; } } // Take input from either the numpad or numerical keys 1-9 and mark the board static void TakeInput(char[] board, char marker) { // Keep track of whether or not the user has pressed a valid key for marking the board bool validKeyPressed = false; // Keep track of the key pressed by the user ConsoleKeyInfo keyPressed; // Do-While loop to catch valid input from the user do { keyPressed = Console.ReadKey(true); // If the key pressed is valid and the spot is unmarked, mark it, // Otherwise break the switch statement and take new key input switch (keyPressed.Key) { case ConsoleKey.NumPad1: case ConsoleKey.D1: if (MakeMove(board, marker, 0)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad2: case ConsoleKey.D2: if (MakeMove(board, marker, 1)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad3: case ConsoleKey.D3: if (MakeMove(board, marker, 2)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad4: case ConsoleKey.D4: if (MakeMove(board, marker, 3)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad5: case ConsoleKey.D5: if (MakeMove(board, marker, 4)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad6: case ConsoleKey.D6: if (MakeMove(board, marker, 5)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad7: case ConsoleKey.D7: if (MakeMove(board, marker, 6)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad8: case ConsoleKey.D8: if (MakeMove(board, marker, 7)) { validKeyPressed = true; break; } break; case ConsoleKey.NumPad9: case ConsoleKey.D9: if (MakeMove(board, marker, 8)) { validKeyPressed = true; break; } break; default: Console.WriteLine("\nPlease use your numpad or the keys 1-9 to choose a spot to mark."); break; } } while (!validKeyPressed); } // Check to see if the board has no unmarked spots left static bool BoardFull(char[] board) { for (int i = 0; i < board.Length; i++) { if (board[i] == ' ') { return false; } } return true; } // Check to see if someone has won or if there is a tie // Return a string to annouce the game's final state static string CheckWinner(char[] board, char marker) { // Horizontal Win if ((board[0] == marker) && (board[1] == marker) && (board[2] == marker)) { gameOver = true; return marker + " wins!\n"; } else if ((board[3] == marker) && (board[4] == marker) && (board[5] == marker)) { gameOver = true; return marker + " wins!\n"; } else if ((board[6] == marker) && (board[7] == marker) && (board[8] == marker)) { gameOver = true; return marker + " wins!\n"; } // Vertical Win else if ((board[0] == marker) && (board[3] == marker) && (board[6] == marker)) { gameOver = true; return marker + " wins!\n"; } else if ((board[1] == marker) && (board[4] == marker) && (board[7] == marker)) { gameOver = true; return marker + " wins!\n"; } else if ((board[2] == marker) && (board[5] == marker) && (board[8] == marker)) { gameOver = true; return marker + " wins!\n"; } // Diagonal Win else if ((board[0] == marker) && (board[4] == marker) && (board[8] == marker)) { gameOver = true; return marker + " wins!\n"; } else if ((board[2] == marker) && (board[4] == marker) && (board[6] == marker)) { gameOver = true; return marker + " wins!\n"; } // Tie Game else if (BoardFull(board)) { gameOver = true; return "No one wins, it's a tie!\n"; } return null; } // Introduce the game to users and explain how to play static void Intro() { Console.WriteLine("\n\n Welcome to Tic Tac Toe!\n\n"); Console.WriteLine(" Currently you can only play against another human player."); Console.WriteLine(" To pick a spot on the Tic Tac Toe board use the keypad or the numbers 1-9."); Console.WriteLine(" You must have num-lock on to be able to use the keypad for input."); Console.WriteLine(" The keypad positions correspond to the Tic Tac Toe board."); DrawExampleBoard(); Console.WriteLine(" Press any key to start the game!"); Console.ReadKey(true); Console.Clear(); } // The Tic Tac Toe Game's heart static void TicTacToeGame(char[] board) { int playerTurn = 1; string winner = ""; while (!gameOver) { // Player 1/O's if (playerTurn == 1) { Console.WriteLine("It is O's turn to move!"); TakeInput(board, 'O'); DrawBoard(board); winner = CheckWinner(board, 'O'); playerTurn = 2; } // Player 2/X's turn else { Console.WriteLine("It is X's turn to move!"); TakeInput(board, 'X'); DrawBoard(board); winner = CheckWinner(board, 'X'); playerTurn = 1; } } Console.WriteLine(winner); } static void Main() { // The Tic Tac Toe board char[] board = {' ',' ',' ',' ',' ',' ',' ',' ',' '}; // Used to keep track of whether a new game has started bool newGame = true; // Do-While loop that runs through the intro and a full game of human vs. human tic tac toe // The loop continues until the user responds with a n or no to another game of tic tac toe do { Intro(); DrawBoard(board); TicTacToeGame(board); Console.WriteLine("Would you like to play again? [Y]es/[N]o?\n"); string response = Console.ReadLine(); switch (response.ToLower()) { case "yes": case "y": gameOver = false; Console.Clear(); ClearBoard(board); break; case "no": case "n": newGame = false; Console.Clear(); ClearBoard(board); break; default: break; } } while (newGame == true); } } } [/source]