Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Shell;
- using System.Collections.Generic;
- namespace Shell
- {
- class GhostsShell : Shell
- {
- //int asd;
- bool nappal;
- bool eneklo, huhogo, kacago;
- bool enekloelozo, huhogoelozo, kacagoelozo;
- bool ablaknyitva;
- bool orgonaltunk;
- bool hanynapja;
- bool jatek;
- List<string> muveletek;
- public GhostsShell()
- {
- AddCommand(new New(this));
- AddCommand(new Print(this));
- AddCommand(new Open(this));
- AddCommand(new Close(this));
- AddCommand(new Get(this));
- AddCommand(new Play(this));
- AddCommand(new Play(this));
- AddCommand(new Go(this));
- }
- class Print : Command
- {
- GhostsShell shell;
- public Print(GhostsShell sh) : base("print")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (args.Length != 0) return false;
- Console.WriteLine(shell.nappal ? "nappal van" : "ejjel van");
- if (shell.nappal)
- {
- Console.WriteLine(shell.ablaknyitva ? "nyitva az ablak" : "az ablak zarva");
- Console.WriteLine(shell.orgonaltunk ? "orgonaltunk" : "nem orgonaltunk");
- shell.nappal = !shell.nappal;
- }
- else
- {
- Console.WriteLine(shell.kacago ? "kacag" : "nem kacag");
- Console.WriteLine(shell.eneklo ? "enekel" : "nem enekel");
- Console.WriteLine(shell.huhogo ? "huhog" : "nem huhog");
- //shell.hanynapja = shell.kacago || shell.eneklo || shell.huhogo ? 0 : shell.hanynapja?;
- }
- return true;
- }
- }
- class Open : Command
- {
- GhostsShell shell;
- public Open(GhostsShell sh) : base("open")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (!shell.jatek) return false;
- if (shell.nappal == false) return false;
- if (args.Length != 1) return false;
- if (!args[0].Equals("windows")) return false;
- shell.ablaknyitva = true;
- return true;
- }
- }
- class Close : Command
- {
- GhostsShell shell;
- public Close(GhostsShell sh) : base("close")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (!shell.jatek) return false;
- if (shell.nappal == false) return false;
- if (args.Length != 1) return false;
- if (!args[0].Equals("windows")) return false;
- shell.ablaknyitva = false;
- return true;
- }
- }
- class Play : Command
- {
- GhostsShell shell;
- public Play(GhostsShell sh) : base("play")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (!shell.jatek) return false;
- if (!shell.nappal) return false;
- if (args.Length != 1) return false;
- if (!args[1].Equals("organ")) return false;
- if (shell.orgonaltunk) return false;
- shell.orgonaltunk = true;
- return true;
- }
- }
- class Go : Command
- {
- GhostsShell shell;
- public Go(GhostsShell sh) : base("go")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (!shell.jatek) return false;
- if (!shell.nappal) return false;
- if (args.Length != 2) return false;
- if (!args[0].Equals("to") || args[1].Equals("bed")) return false;
- shell.nappal = !shell.nappal;
- return true;
- }
- }
- class Get : Command
- {
- GhostsShell shell;
- public Get(GhostsShell sh) : base("get")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (!shell.jatek) return false;
- if (shell.nappal) return false;
- if (args.Length != 1) return false;
- if (!args[0].Equals("up")) return false;
- shell.nappal = !shell.nappal;
- shell.kacagoelozo = shell.kacago;
- shell.huhogoelozo = shell.huhogo;
- shell.enekloelozo = shell.eneklo;
- shell.huhogo = shell.kacagoelozo;
- Console.WriteLine();
- return true;
- }
- }
- class New : Command
- {
- GhostsShell shell;
- public New(GhostsShell sh) : base("new")
- {
- shell = sh;
- }
- public override bool Execute(params string[] args)
- {
- if (args.Length > 1) return false;
- if (args.Length == 1 && !args[0].Equals("initial")) return false;
- if (args.Length == 1)
- {
- shell.nappal = false;
- shell.kacago = shell.huhogo = shell.eneklo = true;
- }
- else
- {
- shell.kacago = shell.IsLaughing();
- shell.eneklo = shell.IsSinging();
- shell.huhogo = shell.IsHooting();
- }
- shell.jatek = true;
- return true;
- }
- }
- }
- public class Program
- {
- public static void Main(string[] args)
- {
- Shell sh = new GhostsShell();
- sh.ReadEvalPrint();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement