static int player1health = 10;
static int player2health = 10;
public static void Main()
Console.WriteLine("Avg : " + Average(10,20));
Console.WriteLine("Fight!");
while(IsGameOver(player1health, player2health) == false) {
Console.WriteLine("Player 1 button: ");
string player1string = Console.ReadLine();
int.TryParse(player1string, out player1button);
for(int i=0; i < 20; i++)
Console.WriteLine("Player 2 button: ");
string player2string = Console.ReadLine();
int.TryParse(player2string, out player2button);
for(int i=0; i < 20; i++)
DoFrame(player1button, player2button);
Console.WriteLine("Match Over!");
static void DoFrame(int player1button, int player2button) {
bool player1attacking = (player1button == 1);
bool player1blocking = (player1button == 2);
bool player1throwing = (player1button == 3);
bool player2attacking = (player2button == 1);
bool player2blocking = (player2button == 2);
bool player2throwing = (player2button == 3);
if(player1attacking == true && player2blocking == false && player2attacking == false) {
if(player1throwing == true && player2attacking == false && player2throwing == false) {
if(player2attacking == true && player1blocking == false && player1attacking == false) {
if(player2throwing == true && player1attacking == false && player1throwing == false)
public static void DamagePlayer(int playerNumber, int damageAmount) {
player1health -=damageAmount;
player2health -=damageAmount;
public static void PrintHealth() {
Console.WriteLine("Player 1 : " + player1health + " Player 2 : " + player2health);
static bool IsGameOver(int health1, int health2){
static int Average(int a, int b) {