Skip to content

Instantly share code, notes, and snippets.

// Assign "Hello World" to a variable message
// Assign a different string to a different variable
// Assign a number to a variable
// Use string interpolation to display the number in a string
// i.e. string interpolation = "Hello {0}"
// Make an array of your favorite movies or books or bands. Have at least 4 values.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Week1Day1
{
class Program
{
Normal: *Requirements 1. Game is played on a 3 x 3 board where players take turns putting 'X' and 'O' in an empty square. 2. A player wins by having all X's or all O's in vertically/horizantly/diagonally. 3. The board is drawn to the console each time a position is played.
Hard: Have the player play as the 'X' and the computer play as an 'O'
Nightmare: The computer plays intelligently (or at least as well as one would expect :) )
class Program
{
private static object currentPlayer;
<script src="https://gist.github.com/CasonBarnhill/b9986b1b1bfacc2aeea6.js"></script>
class Program
{
private static object player;
static void DrawBoard(string[] box)
{
Console.Clear();
Console.WriteLine($"{box[0]} | {box[1]} | {box[2]}");
Console.WriteLine($"{box[3]} | {box[4]} | {box[5]}");
Console.WriteLine($"{box[6]} | {box[7]} | {box[8]}");
Create a 'Pig Dice' game for the console
Gameplay
Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player decides to "hold":
If the player rolls a 1, they score nothing and it becomes the next player's turn. If the player rolls any other number, it is added to their turn total and the player's turn continues. If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn. The first player to score 100 or more points wins.
For example, the first player, Ann, begins a turn with a roll of 5. Ann could hold and score 5 points, but chooses to roll again. Ann rolls a 2, and could hold with a turn total of 7 points, but chooses to roll again. Ann rolls a 1, and must end her turn without scoring. The next player, Bob, rolls the sequence 4-5-3-5-5, after which he chooses to hold, and adds his turn total of 22 points to his score.
Normal
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Week1Day4.cs
//build class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Week_2_day_1
{
//1. build classes for Human, Robot, Panda-
//2. All should have a "DisplayName" and a "DisplayGreeting" method. The name should return the value held in an instance variable "Name"-
namespace week_2_day_2.cs
{
// Mechanic Shop
//We are going to design an application for a local mechanic shop.
//They service 3 types of vehicles: Trucks, Race Cars, and Family Sedans.All vehicles can have their tires and oil changed.
//When filling up gas for the vehicles, we have to be careful what type of gas we put in: Regular, High Performance, and Diesel.
//Create a 'Shop' class, using generics, that can handle these 3 types of cars.
//This 'Shop' class will perform the following functions: ChangeOil and FillUp()
//The 'ChangeTire' function should be tacked on using an extension method of the Shop Class.
//Demonstrate what your Shop Class can do by creating instances of all 3 car types, the shop and call the ChangeTire, FillUp, and ChangeOil functions for each type.
namespace Week2Lab
{
public class Card
{
public Rank Rank { get; set; }
public Suit Suit { get; set; }
public int Value
{
get
{