In the C++ programming language write a program capable of playing Tic-Tac-Toe against the user. Your program should use OOP concepts in its design. You can use ASCII art to generate and display the 3x3 playing board. The program should randomly decide who goes first computer or user. Your program should know and inform the user if an illegal move was made (cell already occupied). The program should also announce if one of the players wins or if a draw is achieved. While it is desirable for your program to play a strong game, this is not an Artificial Intelligence course so if your program does not play at a world champion level you will not be penalized for it
In: Computer Science
Using C language
Problem!! <3 x 3 tic tac toe>
2 players are doing tic tac toe alternatively. Anyone could win when they first make a bingo for any line(horizontal, vertical, diagonal)
[Constraints]
1. Use 2dimensional Array(3 X 3)
2. Each elements are 1 or 2 so that can show their player1, player2's mark.
3. Inputs are 1 through 9 as you can see
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
4. No inputs are duplicated
5. if no one wins after the tictac toe, print out "draw"
Example of screen of output
In: Computer Science
In: Biology
"""stack.py implements stack with a list"""
class Stack(object):
def __init__(self): #creates an empty stack. O(1)
self.top = -1 #the index of the top element of the stack. -1: empty
stack
self.data = []
def push(self, item): # add item to the top of the stack.
O(1)
self.top += 1
self.data.append(item)
def pop(self): # removes and returns the item at the top
O(1)
self.top -=1
return self.data.pop()
def peek(self): # returns the item at the top O(1)
return self.data[len(self.data)-1]
def isEmpty(self): return self.top == -1 #return
len(self.data)==0
def __len__(self): return self.top+1 #return len(self.data)
def __str__(self): return " ".join([str(x) for x in self.data])
#to do: add a main method to test the stack.
In: Computer Science
Objective:
Practice common UNIX commands.
Procedure:
Commands:
chmod u+x Dir1.0 adds execute permission for the owner
chmod go-w file1 removes write permission for the group and others
chmod ugo=rw testfile sets the permissions for everyone to read and write, but not execute
chmod u=rwx newDir sets the permissions for the owner to read, write, and execute
In: Computer Science
assum have a
Class enum Suit{
CLUBS , DIAMONDS,SPADES,HEARTS;
}
Class enum Raml {
TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN, JACK,QUEEN,KING,
ACE;
}
public class Card {
private Suit suit;
private Rank rank;
public Card (Rank rank, Suit suit){
this.suit = suit;
this.rank = rank;
}
public Suit getSuit() {
// TODO Auto-generated method
stub
return suit;
}
public Rank getRank() {
return rank;
}
Class Hand{
given ArrayList<Card> cards;
public Hand(Card[] cards) creates a hand from the cards in the
given array.
public Card playCard(int i): Removes and returns the card with the
given index in cards.
public boolean isSorted () return true if the elements of the cards are in sorted order.
---------------------Java------------------
In: Computer Science
(C++. Please don't use #include <bits/stdc++.h>) This lab exercises your understanding of using a Heap to create a Priority Queue
Follow these steps:
In: Computer Science
Your HTML document should contain the following elements/features:
In: Computer Science
Which of the following is a denial of service attack?
Group of answer choices
When a cracker enters a system through an idle modem, captures the PC attached to the modem, and then gains access to the network to which it is connected.
Both a perpetrator who sends hundreds of messages from randomly generated false addresses, overloading an Internet service provider's e-mail server AND a perpetrator who e-mails the same message to everyone on one or more LISTSERV lists are denial of service attacks.
When an e-mail message is sent through a re-mailer, who removes the message headers making the message anonymous, then resends the message to selected addresses.
When the perpetrator e-mails the same message to everyone on one or more LISTSERV lists.
When a perpetrator sends hundreds of messages from randomly generated false addresses, overloading an Internet service provider's e-mail server.
In: Computer Science
1 mole of H2 and 0.5 mole of O2 gases at 298K are introduced into an insulating reaction chamber, which has a volume of 10 liters and already contains 2 moles of water. Reaction between H2 and O2 is triggered by a spark. Answer the following questions: i) Is the reaction product in the chamber water or steam? What is its temperature? ii) The reaction product pushes a piston through a reversible adiabatic expansion until the pressure in the reaction chamber drops to 1 bar. How much work does the system do? Useful data: enthalpy of reaction of H2O ΔfH(H2O)(298K) = -240 kJ/mol, heat capacity of liquid water C(v,l) = 75 J/(mol·K), heat capacity of steam C(v,g) = 28 J/(mol·K), enthalpy of vaporization of H2O ΔvapH(H2O) = 41 kJ/mol. Assume that liquid water boils at 373K and steam behaves like an ideal gas in the considered situation.
In: Chemistry