Skip to content

Instantly share code, notes, and snippets.

@AndrioCelos
Created August 3, 2018 08:13
Show Gist options
  • Save AndrioCelos/0fce0363dae5e862f3f66340cb938ec3 to your computer and use it in GitHub Desktop.
Save AndrioCelos/0fce0363dae5e862f3f66340cb938ec3 to your computer and use it in GitHub Desktop.
using System;
using AnIRC;
using GameCorner;
namespace WheelOfFortune {
public class Wheel {
internal Space[] spaces;
public int Position;
public Space Space => this.spaces[this.Position];
private Random rng = new Random();
public Prize prize;
public int prizeAmount;
public Wheel(params Space[] spaces) {
this.spaces = spaces;
}
public static Wheel Round1 => new Wheel(
new Space(0 , 2500, Colours.Cyan + Colours.Bold),
new Space(Tag.WildCard , 500, Colours.Green),
new Space(0 , 900, Colours.Yellow),
new Space(0 , 700, Colours.Red),
new Space(0 , 600, Colours.Cyan),
new Space(0 , 800, Colours.Orange),
new Space(Tag.Gift , 500, Colours.Purple),
new Space(0 , 700, Colours.Yellow),
new Space(Tag.Million , 500, Colours.Green),
new Space(0 , 600, Colours.Red),
new Space(0 , 550, Colours.Cyan),
new Space(Tag.HalfCar , 500, Colours.Green),
new Space(0 , 900, Colours.Magenta),
new Space(Tag.Bankrupt , 0, Colours.DarkGray),
new Space(0 , 650, Colours.Purple),
new Space(Tag.FreePlay , 500, Colours.Cyan),
new Space(0 , 700, Colours.Cyan),
new Space(Tag.LoseATurn, 0, Colours.Gray),
new Space(0 , 800, Colours.Red),
new Space(Tag.Prize , 500, Colours.Blue),
new Space(0 , 650, Colours.Magenta),
new Space(Tag.HalfCar , 500, Colours.Green),
new Space(0 , 900, Colours.Orange),
new Space(Tag.Bankrupt , 0, Colours.DarkGray)
);
public Space Spin() {
this.Position = rng.Next(this.spaces.Length);
return this.spaces[this.Position];
}
}
public class Space {
public Tag Tag;
public int Value;
public string Colour;
public Space(Tag tag, string colour) : this(tag, 0, colour) { }
public Space(Tag tag, int value, string colour) {
this.Tag = tag;
this.Value = value;
this.Colour = colour;
}
public override string ToString() {
switch (this.Tag) {
case Tag.Bankrupt : return "Bankrupt";
case Tag.LoseATurn: return "Lose a Turn";
case Tag.FreePlay : return "Free Play";
case Tag.WildCard : /* return "Wild"; */
case Tag.Prize : return "Prize";
case Tag.Gift : /* return "Gift"; */
case Tag.HalfCar : /* return "1/2 Car"; */
case Tag.Million : /* return "One Million"; */
case Tag.Jackpot : /* return "Jackpot"; */
case Tag.Mystery : /* return "Mystery"; */
case Tag.Express : /* return "Express"; */
default: return this.Value.ToString();
}
}
}
public enum Tag {
None,
Bankrupt,
LoseATurn,
FreePlay,
WildCard,
Prize,
Gift,
HalfCar,
Million,
Jackpot,
Mystery,
Express
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment