This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| rosegraphics.py - a simple Graphics library for Python. | |
| Its key feature is: | |
| -- USING this library provides a simple introduction to USING objects. | |
| Other key features include: | |
| -- It has a rich set of classes, methods and instance variables. | |
| In addition to classes like Circles that are natural for students, | |
| it has other kinds of classes like RoseWindow and SimpleTurtle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:cloud_firestore/cloud_firestore.dart'; | |
| import 'package:flutter/material.dart'; | |
| class FirestoreModelUtils { | |
| // A few date time helpers that really don't belong here, but it's easy: | |
| static DateTime fromTimestampToDateTime(Timestamp value) => value.toDate(); | |
| static Timestamp fromDateTimeToTimestamp(DateTime value) => Timestamp.fromDate(value); | |
| static TimeOfDay fromDateTimeToTimeOfDay(DateTime value) { | |
| DateTime epochDate = DateTime(1970, 1, 1, 0, 0); | |
| Duration delta = value.difference(epochDate); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // One possible solution | |
| enum TicTacToeMark { none, x, o } | |
| enum TicTacToeState { xTurn, oTurn, xWon, oWon, tie } | |
| class TicTacToeGame { | |
| var board = List<TicTacToeMark>.filled(9, TicTacToeMark.none); | |
| var state = TicTacToeState.xTurn; | |
| void pressedSquare(int index) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // These methods could be added to your existing class. | |
| /** | |
| * Read button - Gets the state of the fake pushbutton (0 or 1) | |
| * method: GET | |
| * path: /api/readbutton | |
| * expected request body: none | |
| * side effects: none (the pushbutton is always random) | |
| * response: {"button": 0} or {"button": 1} | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rhit = rhit || {}; | |
| rhit.PiSimulatorController = class { | |
| constructor() { | |
| // No separate model object. Just do it within the controller. | |
| this.button = 1; | |
| this.leds = {red: 0, yellow: 1, green: 0}; | |
| this.servos = [-45, 0, 90]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| background: #DDDDDD; | |
| } | |
| .navbar { | |
| background-color: #800000; | |
| color: white; | |
| } | |
| .page-container { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"> | |
| <link rel="stylesheet" href="styles/bootstrap-material-design.min.css"> | |
| <link rel="stylesheet" href="styles/main.css"> | |
| <title>Pi Simulator</title> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rhit.CantStopGame = class { | |
| static NUM_DICE = 3; // Hardcoded but easy to change if making a different game. | |
| static MAX_FIRST_ROLL_VALUE = 3; // Hardcoded but easy to change | |
| static RoundState = { | |
| PLAYER_1_ACTIVE: "Player 1's Turn", | |
| PLAYER_1_BUST: "Player 1 Bust!", | |
| PLAYER_2_ACTIVE: "Player 2's Turn", | |
| PLAYER_2_BUST: "Player 2 Bust!", | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"); | |
| var app = express(); | |
| app.use('/', express.static("public")); | |
| app.use('/api/', express.json()); | |
| let data = {}; | |
| // let data = []; // or an empty array depending on the instructions for your specific exam | |
| const fs = require("fs"); | |
| const serverSideStorage = "../data/db.json"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Authors: Dave Fisher and PUT_YOUR_NAME_HERE. | |
| """ | |
| # TODO: 1. Put your name in the above. | |
| import time | |
| import rosebot | |
| def main(): |