Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions VatsalaTandon010/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"browser": true
}
}
7 changes: 7 additions & 0 deletions VatsalaTandon010/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tictactoe/packages

tictactoe/tictactoe/bin/

tictactoe/tictactoe/obj/

tictactoe/.vs
108 changes: 108 additions & 0 deletions VatsalaTandon010/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="ttt.css">
<title>Tic-Tac-Toe</title>
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script>
function setplayer1(){
var player1= document.getElementById("player1").value;
$.ajax({
url: 'http://localhost:62726/api/scoresheets/'+player1,
type: 'GET',
dataType:'json',
success: function(res) {
document.getElementById("scorex").value=res.score;
},
error:function(e){
var dataToSend={
"Player": player1,
"score":0
}
$.ajax({
url: 'http://localhost:62726/api/scoresheets',
data: dataToSend,
type: 'POST',
dataType:'json',
success: function(res) {
console.log(res);
alert("Player added");
}
});
}
});
}
function setplayer2(){
var player2= document.getElementById("player2").value;
$.ajax({
url: 'http://localhost:62726/api/scoresheets/'+player2,

type: 'GET',
dataType:'json',
success: function(res) {
document.getElementById("scoreo").value=res.score;
},
error:function(e){
var dataToSend={
"Player": player2,
"score":0
}
$.ajax({
url: 'http://localhost:62726/api/scoresheets',
data: dataToSend,
type: 'POST',
dataType:'json',
success: function(res) {
console.log(res);
alert("Player added");
}
});
}
});
}

</script>
</head>
<body>
<h1>Tic Tac Toe</h1>
<div class="playernames">
<input type="text" placeholder="Player1" id="player1"/>
<input type="button" onclick="setplayer1();" value="Enter"/>
<input type ="text" placeholder="score" id="scorex"><br>
<input type="text" placeholder="Player2" id="player2"/>
<input type="button"onclick="setplayer2();" value="Enter"/>
<input type="text" placeholder="score" id="scoreo"><br>

</div>
<button class="restart" , onclick="restart();">Start Game / &olarr;</button>
<div id="main" >
<table>
<tr>
<td class="buttonn" id="move1" >Make a move</td>
<td class="buttonn" id="move2" >Make a move</td>
<td class="buttonn" id="move3" >Make a move</td>
</tr>
<tr>
<td class="buttonn" id="move4" >Make a move</td>
<td class="buttonn" id="move5" >Make a move</td>
<td class="buttonn" id="move6" >Make a move</td>
</tr>
<tr>
<td class="buttonn" id="move7" >Make a move</td>
<td class="buttonn" id="move8" >Make a move</td>
<td class="buttonn" id="move9" >Make a move</td>
</tr>
</table>
</div>
<div class="gameover">
<div class="text" id="winner"><h5> Player1:O Player2:X</div>
</div>

<script src="ttt.js"></script>

</body>
</html>
22 changes: 22 additions & 0 deletions VatsalaTandon010/tictactoe/tictactoe.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 14 for Web
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tictactoe", "tictactoe\tictactoe.csproj", "{F5C4FF96-0654-4BB2-9185-C89291FCB755}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F5C4FF96-0654-4BB2-9185-C89291FCB755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5C4FF96-0654-4BB2-9185-C89291FCB755}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5C4FF96-0654-4BB2-9185-C89291FCB755}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5C4FF96-0654-4BB2-9185-C89291FCB755}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions VatsalaTandon010/tictactoe/tictactoe/App_Start/WebApiConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Http.Cors;

namespace tictactoe
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
84 changes: 84 additions & 0 deletions VatsalaTandon010/tictactoe/tictactoe/ApplicationInsights.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
Use the following syntax here to collect additional performance counters:

<Counters>
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
...
</Counters>

PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName

Counter names may only contain letters, round brackets, forward slashes, hyphens, underscores, spaces and dots.
You may provide an optional ReportAs attribute which will be used as the metric name when reporting counter data.
For the purposes of reporting, metric names will be sanitized by removing all invalid characters from the resulting metric name.

NOTE: performance counters configuration will be lost upon NuGet upgrade.

The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
<Handlers>
<!--
Add entries here to filter out additional handlers:

NOTE: handler configuration will be lost upon NuGet upgrade.
-->
<Add>System.Web.Handlers.TransferRequestHandler</Add>
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
<Add>System.Web.StaticFileHandler</Add>
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
<Add>System.Web.Optimization.BundleHandler</Add>
<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
<Add>System.Web.Handlers.TraceHandler</Add>
<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
<Add>System.Web.HttpDebugHandler</Add>
</Handlers>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
</TelemetryModules>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
</Add>
</TelemetryProcessors>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840

Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
-->
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DomainNameRoleInstanceTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
<Filters>
<Add Pattern="(YottaaMonitor|BrowserMob|HttpMonitor|YandexBot|BingPreview|PagePeeker|ThumbShotsBot|WebThumb|URL2PNG|ZooShot|GomezA|Catchpoint bot|Willow Internet Crawler|Google SketchUp|Read%20Later|KTXN|Pingdom|AlwaysOn)"/>
<Add Pattern="Slurp" SourceName="Yahoo Bot"/>
<Add Pattern="(bot|zao|borg|Bot|oegp|silk|Xenu|zeal|^NING|crawl|Crawl|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|^Java/|^JNLP/|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|spider|Spider|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|^voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr\-agent|Squrl Java|A6\-Indexer|netresearch|searchsight|http%20client|Python-urllib|dataparksearch|Screaming Frog|AppEngine-Google|YahooCacheSystem|semanticdiscovery|facebookexternalhit|Google.*/\+/web/snippet|Google-HTTP-Java-Client)"
SourceName="Spider"/>
</Filters>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
</TelemetryInitializers>
</ApplicationInsights>
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using tictactoe.Models;

namespace tictactoe.Controllers
{
public class scoresheetsController : ApiController
{
private tictactoeEntities1 db = new tictactoeEntities1();

// GET: api/scoresheets
public IQueryable<scoresheet> Getscoresheets()
{
return db.scoresheets;
}

// GET: api/scoresheets/5
[ResponseType(typeof(scoresheet))]
public IHttpActionResult Getscoresheet(string id)
{
scoresheet scoresheet = db.scoresheets.Find(id);
if (scoresheet == null)
{
return NotFound();
}

return Ok(scoresheet);
}

// PUT: api/scoresheets/5
[ResponseType(typeof(void))]
public IHttpActionResult Putscoresheet(string id, scoresheet scoresheet)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

if (id != scoresheet.Player)
{
return BadRequest();
}

db.Entry(scoresheet).State = EntityState.Modified;

try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!scoresheetExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return StatusCode(HttpStatusCode.NoContent);
}

// POST: api/scoresheets
[ResponseType(typeof(scoresheet))]
public IHttpActionResult Postscoresheet(scoresheet scoresheet)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

db.scoresheets.Add(scoresheet);

try
{
db.SaveChanges();
}
catch (DbUpdateException)
{
if (scoresheetExists(scoresheet.Player))
{
return Conflict();
}
else
{
throw;
}
}

return CreatedAtRoute("DefaultApi", new { id = scoresheet.Player }, scoresheet);
}

// DELETE: api/scoresheets/5
[ResponseType(typeof(scoresheet))]
public IHttpActionResult Deletescoresheet(string id)
{
scoresheet scoresheet = db.scoresheets.Find(id);
if (scoresheet == null)
{
return NotFound();
}

db.scoresheets.Remove(scoresheet);
db.SaveChanges();

return Ok(scoresheet);
}

protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}

private bool scoresheetExists(string id)
{
return db.scoresheets.Count(e => e.Player == id) > 0;
}
}
}
1 change: 1 addition & 0 deletions VatsalaTandon010/tictactoe/tictactoe/Global.asax
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="tictactoe.WebApiApplication" Language="C#" %>
Loading